3 Replies Latest reply: Oct 5, 2012 7:52 AM by Yann39 RSS

    Dynamically Hide Last Column in Report

      I have a classic report being generated from a dynamic query. I never know how many columns will be returned from this query. I need to show/hide the last column in my report. Any help would be greatly appreciated.

        • 1. Re: Dynamically Hide Last Column in Report

          just some ideas :

          If you never know the number of columns, I think the faster way is to use some JavaScript/JQuery to hide the last report column on load.

          But maybe you can return the number of column in the query itself ? For example in #COL01# (don't display it).
          Then in each other report columns, use a display condition #COL01# != 2, #COL01# != 3, #COL01# != 4, etc.
          So the last column of the report will be hidden automatically.

          Or another solution is to get your report region source from <font face="courier">apex_application_page_regions</font>, then get the number of columns using DBMS_SQL to be able to use it in the conditions.

          Good luck.

          • 2. Re: Dynamically Hide Last Column in Report

            as suggested you can use jQuery selector.

            In your report set static id to let's say MYTABLE, then in same region in footer section put
              $('#MYTABLE table table td:last-child').hide();
              $('#MYTABLE table table td:last-child,th:last-child').hide();
            The 'tricky' part in Apex is that when you set static id you actually set it for region (which is a defined as a table) and not for table which is actually displaying data. This table is inside the table for which you set up static id. So that's why you have to use "table table" selector.

            • 3. Re: Dynamically Hide Last Column in Report
              But think that with the JavaScript/JQuery solution, a user will be able to show back the column.
              Not a problem if you don't care about this, but with the solution using report column conditions, it is more "secure" I think :)