Trying to create an Ad Hoc report where the user selects 2 entities

Hello,
I am trying to create an Ad Hoc report where the user selects 2 entities and based on that we show the fields they can display on the report as checkboxes. Once the user selects the fields for both entities, we need to allow for filter selection. Once the user hits submit, we need to get only the columns selected with the chosen filters. IS there a way to dynamically run the query and dynamically set the columns in the grid that displays the results?
Thanks,
Bindu

OriginalPostID-177575

OriginalPostID-177575

  Discussion posts and replies are publicly visible

  • You can start with displaying all the columns available for the 2 selected entities as choice labels in a checkbox and all the values selected by the user can be stored in a constant variable.
    a!gridField(
    totalCount: local!datasubset.totalCount,
    columns:{
    a!applyComponents(rule!createDynamicGridColumn(datasubSet:local!datasubset,index: _),
    if(or(isnull(cons!DS_gridColumns), count(cons!DS_gridColumns) < 1), {}, 1+enumerate(length(cons!DS_gridColumns))),
    "")},)
    **************************
    createDynamicGridColumn
    **************************
    a!gridTextColumn(
    label: cons!DS_gridColumns[ri!index],
    field: cons!DS_gridColumns[ri!index],
    data: index(
    ri!datasubSet.data,
    cons!DS_gridColumns[ri!index],{}),
    alignment: "RIGHT")
    Even for the filter you should be able to confgure it the same way.