We're facing problem with SAIL Grid when sorting grid data on header click.

We're facing problem with SAIL Grid when sorting grid data on header click. However default sorting is working when grid renders first time. Please find the case explained below.

We're fetching data from query record and displaying it in a SAIL grid after aggregation.

When we click at the grid's header, sorting doesn't work, it gives exception i.e. "Expression evaluation error at function 'todatasubset' [line 35]: Error evaluating function 'todatasubset' : java.lang.IllegalArgumentException: The given data type is not a record type: Dictionary (id=94)".

When we use query rule to fetch the data instead of query record it works properly.

Reason why we're using query record is that we're doing aggregation / grouping on data.

Please provide some suggestion to this exception or alternate solution to fetch data in aggregate / grouped form from database.

For your reference please find sample code below.

load(
local!pagingInfo: topaginginfo(1,10), ...

OriginalPostID-93073

OriginalPostID-93073

  Discussion posts and replies are publicly visible

  • ...
    local!querydata:queryrecord(
    recordType: cons!COMPANY_AUDIT_LOG,
              query: 'type!{www.appian.com/.../2009}Query'(
              'selection|aggregation': 'type!{www.appian.com/.../2009}Aggregation'(
              columns: {
              'type!{www.appian.com/.../2009}AggregationColumn'(
              field: "full_name",
              alias: "label",
              visible: true,
              isGrouping: true
              ),
              'type!{www.appian.com/.../2009}AggregationColumn'(
              field: "no_of_company_count",
              alias: "data",
              visible: true,
              aggregationFunction: "SUM"
              )
              }
              ),          
              pagingInfo:
              a!pagingInfo(
              startIndex: 1,
              batchSize: -1,
              sort: a!sortInfo(
              field: "label",
              ascending: true
              )
              )
              )
              ),
              with(
    local!data:todatasubset(local!querydata.data,local!pagingInfo),
              a!formLayoutColumns(                               
              instructions: "In this report we can view the # of co...
  • ...mpanies created by the Analyst(s) during a Year / Month / Week in tabular as well as graphical view",                              
              columns:{                                                  
              a!columnLayout(                                                  
              contents: {                                                            
              a!sectionLayout(                                                                      
              firstColumnContents: {                                                                                                    
              'type!{www.appian.com/.../2009}Grid'(                                                                                                              
              totalCount:local!data.totalCount,                                                                                                              
              instructions: "Test",                                                                                                              
              columns: {                                                                                                              
              'type!{www.appian.com/.../2009}GridTextColumn'(                                                                                                                                            
              label: "Analyst",                                                                                                                                                      
              data: index(local!data.data, "label",0),                                                                                                                                                      
              field: "label"                                                                                                                                            
              ),                                                                                                                                            
              'type!{www.appian.com/.../2009}GridTextColumn'(                                                                                                                                                      
              label: "# of Companies Created",                                                                                                                                                      
              data: index(local!data.data, "data",0),                                                                                                                                                      
              field: "data"                                                                                                                                            
              )                                                                                                                                  
              },                                                                                                    
              value: local!pagingInfo,                                                                                                              
              saveInto: local!pagingInfo                                                                                                    
              )                                                                      
              }                                                            
              )                                                  
              }                                        
              )                              
              }          
              )
              )
    )



    Many thank...
  • The todatasubset expects the output of your query rule, not the data. Change this line

    FROM:

    local!data:todatasubset(local!querydata.data,local!pagingInfo),

    to

    local!data:todatasubset(local!querydata,local!pagingInfo),