Get the distinct value in each column read-only grid

Column A Column B Column C Column D Column E
101110 56798 robert xyz dgh
101110 56798 robert xyz dgh
101114 78789 youn hdg dhh

above mentioned is data base table need to fetch the district value in each column , I have applied aggregation on multiple column but did not worked .

I want a result below read only  grid duplicate should remove . 

Column A Column B Column C Column D Column E
101110 56798 robert xyz dgh
101114 78789 royan hdg dhh

a!queryEntity(
  entity: cons!TEST_ENTITY,
  query: a!query(
    aggregation: a!queryAggregation(aggregationColumns: {
      a!queryAggregationColumn(field: "Column A", isGrouping: true),
      a!queryAggregationColumn(field: "Column B", isGrouping: true),
      a!queryAggregationColumn(field: "Column C", isGroupong: true),
    }),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: 20,
      sort: {
        a!sortInfo(
          field: "Column A",
          ascending: true
        ),
        a!sortInfo(
          field: "Colum B",
          ascending: true
        ),
        a!sortInfo(
          field: "Colum C",
          ascending: true
        )
} ) ) )

  Discussion posts and replies are publicly visible

Parents
  • Aggregating on multiple columns will return rows with any unique combination of those 3 columns, sounds like you need to break the row associations for the data and display a list of values unrelated to the other values in the row, which does not work with multiple aggregations.

    The issue here will be if you have a large data set and need to apply pagingInfo, you will need to make one call to the database PER column with the grouping aggregation, then apply into a grid from 5 different data sets.  If you make one call and apply say a page size of 20, you will only get the unique values for that page.

    Otherwise with moderate data sets you can do something like below with one call and no paging:

    a!localVariables(
      local!data: {
        {columnA: 101110, columnB: 56789, columnC: "robert", columnD: "xyz",columnE: "dgh"},
        {columnA: 101110, columnB: 56789, columnC: "robert", columnD: "xyz",columnE: "dgh"},
        {columnA: 101114, columnB: 78789, columnC: "youn", columnD: "hdg",columnE: "dhh"}
      },
      local!columnA: union(local!data.columnA,local!data.columnA),
      local!columnB: union(local!data.columnB,local!data.columnB),
      local!columnC: union(local!data.columnC,local!data.columnC),
      local!columnD: union(local!data.columnD,local!data.columnD),
      local!columnE: union(local!data.columnE,local!data.columnE),
      local!max: max(count(local!columnA),count(local!columnB),count(local!columnC),count(local!columnD),count(local!columnE)),
      
      a!gridLayout(
         totalCount: local!max,
         headerCells: a!forEach(items: {"A","B","C","D","E"}, expression: a!gridLayoutHeaderCell(label: concat("Column ",fv!item))),
         rows: a!forEach(
           items: 1+enumerate(local!max),
           expression: a!gridRowLayout(
             id: fv!index,
             contents: {
               a!textField(readOnly: true, value: index(local!columnA,fv!index,null)),
               a!textField(readOnly: true, value: index(local!columnB,fv!index,null)),
               a!textField(readOnly: true, value: index(local!columnC,fv!index,null)),
               a!textField(readOnly: true, value: index(local!columnD,fv!index,null)),
               a!textField(readOnly: true, value: index(local!columnE,fv!index,null))
             }
           )
         )
      )
    )

Reply
  • Aggregating on multiple columns will return rows with any unique combination of those 3 columns, sounds like you need to break the row associations for the data and display a list of values unrelated to the other values in the row, which does not work with multiple aggregations.

    The issue here will be if you have a large data set and need to apply pagingInfo, you will need to make one call to the database PER column with the grouping aggregation, then apply into a grid from 5 different data sets.  If you make one call and apply say a page size of 20, you will only get the unique values for that page.

    Otherwise with moderate data sets you can do something like below with one call and no paging:

    a!localVariables(
      local!data: {
        {columnA: 101110, columnB: 56789, columnC: "robert", columnD: "xyz",columnE: "dgh"},
        {columnA: 101110, columnB: 56789, columnC: "robert", columnD: "xyz",columnE: "dgh"},
        {columnA: 101114, columnB: 78789, columnC: "youn", columnD: "hdg",columnE: "dhh"}
      },
      local!columnA: union(local!data.columnA,local!data.columnA),
      local!columnB: union(local!data.columnB,local!data.columnB),
      local!columnC: union(local!data.columnC,local!data.columnC),
      local!columnD: union(local!data.columnD,local!data.columnD),
      local!columnE: union(local!data.columnE,local!data.columnE),
      local!max: max(count(local!columnA),count(local!columnB),count(local!columnC),count(local!columnD),count(local!columnE)),
      
      a!gridLayout(
         totalCount: local!max,
         headerCells: a!forEach(items: {"A","B","C","D","E"}, expression: a!gridLayoutHeaderCell(label: concat("Column ",fv!item))),
         rows: a!forEach(
           items: 1+enumerate(local!max),
           expression: a!gridRowLayout(
             id: fv!index,
             contents: {
               a!textField(readOnly: true, value: index(local!columnA,fv!index,null)),
               a!textField(readOnly: true, value: index(local!columnB,fv!index,null)),
               a!textField(readOnly: true, value: index(local!columnC,fv!index,null)),
               a!textField(readOnly: true, value: index(local!columnD,fv!index,null)),
               a!textField(readOnly: true, value: index(local!columnE,fv!index,null))
             }
           )
         )
      )
    )

Children
No Data