Change label name based on filter selection

Certified Senior Developer

Hi,
Good Day!!

 users selects a filter which has 2 values Study or customer.
default value is "Study"

a!gridField(
                  labelPosition: "ABOVE",
                  data: 'recordType!List of Studies',
                  columns: {
                    a!gridColumn(
                      label: if('recordType!List of Studies.fields.{isCustomer}isCustomer'="1",
                        "Customer ID",
                        "Project Number"),
                      sortField: 'recordType!List of Studies.fields.{projectNumber}projectNumber' ,
                      value: fv!row['recordType!List of Studies.fields.{projectNumber}projectNumber'],
                      helpTooltip: "If you do not see your project code, please consult with your PD and GRM Administration to resolve."
                    ),
                    a!gridColumn(
                      label:  if('recordType!List of Studies.fields.{isCustomer}isCustomer'="1",
                      "Customer Name",
                      "Sponsor Name"),
                      sortField: 'recordType!List of Studies.fields.{sponsorName}sponsorName' ,
                      width: "AUTO",
                      value: fv!row['recordType!List of Studies.fields.{sponsorName}sponsorName']
                    ),
                    a!gridColumn(
                      label:  if('recordType!List of Studies.fields.{isCustomer}isCustomer'="1",
                      "Description",
                      "Project Name"),
                      sortField:  'recordType!List of Studies.fields.{studyName}studyName',
                      widthttps://community.appian.com/discussions/f/user-interface/p/addpost#h: "WIDE",
                      value: fv!row['recordType!List of Studies.fields.{studyName}studyName']
                    ),

based on the selections required projects are displayed, if Study is selected the columns name should be 
proj no.. , sponser name , project name 

if customer is selected the columns names should be 
cust no.., cust name, description

we are using records, we have a field called is customer (its a flag) from where we are getting study projects and customer projects

 

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    I assume you're using built-in filters; AFAIK there's no visibility within the column configurations (or anywhere else in the grid code) to what the current value of the built-in filters might be.  It most certainly won't work like you currently have it, where you're referencing the entire array of "isCustomer" values for the entire record data set.

    You could probably implement something that changes your column names in the way you want if you construct your own filters that save the filtering values selected into local variables which are then used in the record data query (which you'd also have to do manually).  It would be a bit harder to set up, but vastly more flexible.