Forum Stats

  • 3,838,599 Users
  • 2,262,384 Discussions
  • 7,900,692 Comments

Discussions

Adding Column Toggle feature to a classic report

User_GP1QN
User_GP1QN Member Posts: 223 Blue Ribbon

I know how to show/hide columns in a classic report using Server Side Conditions.

Is there a way to integrate the nice UI from a Column Toggle Report to a Classic report? So that I can show/hide columns in a classic report as a user?

thank you -

mt in NY

Answers

  • User_GP1QN
    User_GP1QN Member Posts: 223 Blue Ribbon

    @fac586 that's exactly what I want, but - where how do I find the instructions on how to do it? What's it called in the documentation?

  • fac586
    fac586 Senior Technical Architect Member Posts: 21,101 Red Diamond

    That's exactly what I want, but - where how do I find the instructions on how to do it?

    When I can find the time to post them. 😀

    It was way too late last night and it turns out I don't have the time today.

    What's it called in the documentation?

    The key feature is another variation on the popup regions you discovered today: an inline popup region containing a checkbox group item; plus a button; a couple of dynamic actions; and the server-side column conditions mentioned above.

    I would stress that it's demonstrating the possibility of a declarative solution. It'll do for a couple of pages but it wouldn't be practical to apply it to every report in an application. That begs the usual question: What problem are you actually trying to solve?

  • User_GP1QN
    User_GP1QN Member Posts: 223 Blue Ribbon

    @fac586 there are only a few pages that have too many columns, where I might want to implement the column/toggle.

  • fac586
    fac586 Senior Technical Architect Member Posts: 21,101 Red Diamond
    edited Jun 30, 2022 8:12PM

    This demo was constructed as follows:

    1. Add a button in the required position and assign it a Static ID.

    2. Create a Static Content region with template Inline Popup in the Dialogs, Drawers and Popups position, and assign it Static ID.

    3. Set the region template options:

    • Auto Height
    • Remove Body Padding
    • Remove Page Overlay
    • Size: None
    • Callout Position: Below

    4. Use the region Custom Attributes to define the popup display position below the button using the data-parent-element attribute and the static ID previously assigned to the button:

    data-parent-element="#button-static-id"
    

    5. Add a Checkbox Group page item with template Hidden and Label Column Span: 0 to the popup region.

    5. Set the item template options:

    • Left Margin: Small
    • Right Margin: Small

    7. Disable Display Extra Values, and set the item LOV Type to SQL Query, with the query:

    select
        heading
      , column_alias
    from
        apex_application_page_rpt_cols
    where
        application_id = :app_id
    and page_id = :app_page_id
    and region_name = 'Classic Report' -- Change to the relevant report region name
    order by
        display_sequence
    

    8. Create a Dynamic Action to display the popup region:

    • When
      • Event: Click
      • Selection Type: Button
      • Button: "Columns..." button
    • Client-side Condition
      • Type: JavaScript expression
      • JavaScript expression: $('#popup-static-id:visible').length === 0
    • True Action
      • Action: Open Region
        • Selection Type: Region
        • Region: Popup region
      • False Action
      • Action: Close Region
        • Selection Type: Region
        • Region: Popup region

    9. Create a Dynamic Action to refresh the report:

    • When
      • Event: Change
      • Selection Type: Item
      • Item: Checkbox Group item
    • True Action
      • Action: Refresh
      • Selection Type: Region
      • Region: Popup region

      10. Set Server-side Conditions on each of the classic report columns, changing the respective COL_ALIAS names:

      • Type: Expression
      • Language: PL/SQL
      • PL/SQL Expression: ':' || :px_checkbox_group_item || ':' like '%:COL_ALIAS:%'


  • User_GP1QN
    User_GP1QN Member Posts: 223 Blue Ribbon

    @fac586 thank you for writing out the explicit directions; I'm relieved to see it wasn't a simple setting for a classic report that I hadn't seen, and that it's a custom solution. I'll play with it tonight or over the weekend.

    Will you be putting the instructions at the demo, so it's all in one place?

  • fac586
    fac586 Senior Technical Architect Member Posts: 21,101 Red Diamond

    Will you be putting the instructions at the demo, so it's all in one place?

    No, that makes the demo pages in the App Builder too complex for me to understand!