9 Replies Latest reply on Oct 12, 2017 6:54 AM by fac586

    5.1: apex_item not populating g_fxx collections when column is hidden

    Stefan P Knecht

      If I create a standard report and select a column using apex_item.hidden(1, foo), set the column type to "Hidden Column" and then submit the page, I receive ORA-1403 no data found when trying to access it via apex_application.g_f01.

       

      Why is that?

       

      If I use a "Plain Text" column, it works. But then the hidden column is visible rendered (e.g. takes up a column in the report).

       

      This shows the issue:

       

      https://apex.oracle.com/pls/apex/f?p=77184:21

       

      The problem for me in using "Plain Text" is that the column visibly takes up screen space, and if you've got a whole bunch of hidden columns, that's a whole load of screen space for nothing.

       

      Is there any way to get APEX to populate the corresponding collection when using a Hidden Column?

       

      Stefan

        • 1. Re: 5.1: apex_item not populating g_fxx collections when column is hidden
          fac586

          Stefan P Knecht wrote:

           

          If I create a standard report and select a column using apex_item.hidden(1, foo), set the column type to "Hidden Column" and then submit the page, I receive ORA-1403 no data found when trying to access it via apex_application.g_f01.

           

          Why is that?

          From what can be seen in the example, it's because the hidden value is using apex_application.g_fx02:

           

          <td class="t-Report-cell" headers="HIDDEN2">
            <input type="hidden" name="f02" value="APEX$TEAM_DEV_FILES">
          </td>
          

           

          If the issue is not as obvious as that (maybe due to a typo/oversight on your part) then we really need to see the whole thing from end-to-end: report query, column settings, and page accept processing.

          • 2. Re: 5.1: apex_item not populating g_fxx collections when column is hidden
            Pavel_p

            Hi Stefan,

            it's not obvious what you are doing and what problem you're trying to solve, but let's assume you have report is based on the following select:

            select apex_item.hidden(p_idx => 1,p_value => table_name) tbl_name_hidden,table_name from all_tables where rownum <= 5
            

            then you can process the records

            begin
              for i in 1..apex_application.g_f01.count loop
                apex_debug.message('DEBUGMSG: hidden item value is %s',apex_application.g_f01(i));
              end loop;
            end;
            

            Debug trace:

            DEBUGMSG: hidden item value is AUDIT_ACTIONS

            DEBUGMSG: hidden item value is DUAL

            DEBUGMSG: hidden item value is STMT_AUDIT_OPTION_MAP

            DEBUGMSG: hidden item value is SYSTEM_PRIVILEGE_MAP

            DEBUGMSG: hidden item value is TABLE_PRIVILEGE_MAP

             

            Regards,

            Pavel

             

            edit: I was a bit late, the cause why it does not work is already revealed

            • 3. Re: 5.1: apex_item not populating g_fxx collections when column is hidden
              Stefan P Knecht

              Thanks for replying, but, no no that's not it.

               

              The problem I ran into was with a report that had 8 total columns produced by apex_item. 3 of those 8 I could read with apex_application, the other 5 I could not. So it's not just a mix-up with the numbers.

               

              It boiled down to the fact that if the report column is Hidden, the corresponding apex_application.g_fxx is empty / invalid. If the report column is set to Plain Text, the corresponding apex_application.g_fxx is populated. That just seems wrong to me. Whether the column is rendered / printed on screen or not shouldn't affect this IMHO?

              • 4. Re: 5.1: apex_item not populating g_fxx collections when column is hidden
                Stefan P Knecht

                To add more details:

                 

                1) Create a standard report with this query:

                 

                 

                select table_name,

                       apex_item.hidden(1, table_name) as hidden1,

                       apex_item.hidden(2, table_name) as hidden2

                  from user_tables

                 

                 

                You have three columns, two of those are apex_item.

                 

                 

                2) Set the column HIDDEN1 to "Hidden Column" and set the column HIDDEN2 to "Plain Text".

                 

                 

                3) Then, add a little submit button and an on-submit process that simply does this:

                 

                 

                apex_error.add_error(apex_application.g_f01(1), p_display_location => apex_error.c_inline_in_notification);

                 

                 

                This will fail with "No data found".

                 

                 

                But if you run this instead:

                 

                 

                apex_error.add_error(apex_application.g_f02(1), p_display_location => apex_error.c_inline_in_notification);

                 

                 

                It will work.

                 

                 

                I find that to be wrong. I don't see any reason why APEX should ignore the column HIDDEN1 and NOT populate apex_application.g_f01.

                 

                 

                Why do the report column types affect whether or not the global collection is populated?

                • 5. Re: 5.1: apex_item not populating g_fxx collections when column is hidden
                  Stefan P Knecht

                  That's another thing that bothers me with "Hidden" columns. They aren't just "hidden" they are not rendered at all.

                   

                  if you produce a report with said query:

                  select table_name,

                         apex_item.hidden(1, table_name) as hidden1,

                         apex_item.hidden(2, table_name) as hidden2

                    from user_tables

                  When setting HIDDEN1 to "Hidden Column" you will find that the resulting HTML will look like this:

                   

                  <tr><td class="t-Report-cell" headers="HIDDEN2"><input type="hidden" name="f02" value="APEX$_WS_HISTORY"></td><td class="t-Report-cell" headers="TABLE_NAME">APEX$_WS_HISTORY</td></tr>

                   

                  It only contains TWO columns, not THREE as in the query. The hidden column is entirely omitted. Is that a bug or intentional?

                   

                  Because  is appears to me that the word hidden is misleading here. The way this behaves, a hidden column isn't hidden, it's voided. It can't be accessed in any way possible (not in JS, not in apex_application, not anywhere). Which makes me wonder what purpose they serve to begin with?

                  • 6. Re: 5.1: apex_item not populating g_fxx collections when column is hidden
                    fac586

                    Stefan P Knecht wrote:

                     

                    That's another thing that bothers me with "Hidden" columns. They aren't just "hidden" they are not rendered at all.

                     

                    if you produce a report with said query:

                    select table_name,

                    apex_item.hidden(1, table_name) as hidden1,

                    apex_item.hidden(2, table_name) as hidden2

                    from user_tables

                    When setting HIDDEN1 to "Hidden Column" you will find that the resulting HTML will look like this:

                     

                    <tr><td class="t-Report-cell" headers="HIDDEN2"><input type="hidden" name="f02" value="APEX$_WS_HISTORY"></td><td class="t-Report-cell" headers="TABLE_NAME">APEX$_WS_HISTORY</td></tr>

                     

                    It only contains TWO columns, not THREE as in the query. The hidden column is entirely omitted. Is that a bug or intentional?

                     

                    Because is appears to me that the word hidden is misleading here. The way this behaves, a hidden column isn't hidden, it's voided. It can't be accessed in any way possible (not in JS, not in apex_application, not anywhere). Which makes me wonder what purpose they serve to begin with?

                    There is confusion between two different uses of "hidden" here.

                     

                    1. apex_item.hidden is an API method used to generate an HTML form control consisting of an input element with a type attribute set to hidden. This generates an element that is rendered in the page, but is not apparent to the user, and contains a value that "is not intended to be examined or manipulated by the user". However, it is a node in the DOM, can be accessed and manipulated by scripts, and if not disabled, its value will be POSTed and enetered into session state (apex_application.g_fxx) when the page is submitted.
                    2. An APEX report column of type "Hidden Column" is not rendered in the page. It also contains data that "is not intended to be examined or manipulated by the user", but this is never sent to the browser. The purpose of hidden columns is to provide data that can be referenced elsewhere in the report (typically in HTML Expressions and link attributes defined for other columns), not in the browser at runtime.

                     

                    The basic problem is therefore that "hidden" form controls will never be included in the page if they are contained in a "hidden" report column. There are various options for including hidden input elements in a report, depending on what they are being used for and the contents of the other (displayed) columns. Can you provide more information about your use case?

                    • 7. Re: 5.1: apex_item not populating g_fxx collections when column is hidden
                      Stefan P Knecht

                      The use case is simply to include a column in the report that I can reference via Javascript, but the user does not see. I don't mind if they see it in the source of the page or not, that's irrelevant. But using an apex_item.hidden, which then visibly takes up a report column (a couple pixels wide) seems weird.

                       

                      I haven't yet found a clean solution that lets me do that using a standard report region.

                      • 8. Re: 5.1: apex_item not populating g_fxx collections when column is hidden
                        Stefan P Knecht

                        Alernatively, if I can add a column, that is not rendered, but properly populates the corresponding apex_application.g_fxx, that's fine too.

                        • 9. Re: 5.1: apex_item not populating g_fxx collections when column is hidden
                          fac586

                          Stefan P Knecht wrote:

                           

                          The use case is simply to include a column in the report that I can reference via Javascript, but the user does not see. I don't mind if they see it in the source of the page or not, that's irrelevant. But using an apex_item.hidden, which then visibly takes up a report column (a couple pixels wide) seems weird.

                           

                          I haven't yet found a clean solution that lets me do that using a standard report region.

                          As stated above, there are various solutions, depending on what the hidden values are used for, and the contents of the displayed columns.

                           

                          • Are the hidden values only referenced via JavaScript? Or manipulated via JavaScript and included in page submission?
                          • Are any of the displayed columns also dynamically generated form controls?
                          • Is the report downloadable by the user?