Custom filters on CDT that is not associated with any table.

Certified Associate Developer

Hello community,

I am trying to make UI which has a read only grid which is populated based on data from integration, we passed a cdt as an input to this grid, now I wanted to put filters on that data using drop downs and date filters (start date and end date), I did came up filtering the cdt using wherecontains() function and foreach() loop and got different index for them. but I couldn't make them work like record filters. how do I group them ?

some code below for understanding.

Thanks.

a!localVariables(
      local!selection,
      local!responseData: rule!PNK_DataForGrid(),
      local!actualData: local!responseData,
      local!customerAddress: union(
        local!actualData.customerName,
        local!actualData.customerName
      ),
      local!customerNameSelection,
      local!ftaNames: union(
        local!actualData.customerAddress,
        local!actualData.customerAddress
      ),
      local!customerAddressselection,
      local!startDate,
     
      local!endDate,
     
      local!idx1: wherecontains(
        touniformstring(local!customerNameSelection),
        touniformstring(local!actualData.customerName)
      ),
      local!idx2: wherecontains(
        touniformstring(local!customerAddressselection),
        touniformstring(local!actualData.customerAddress)
      ),
      local!idx3: fn!reject(
        fn!isnull,
        a!forEach(
          items: local!actualData,
          expression: if(
            or(
              rule!fn!IsNull(local!startDate),
              rule!fn!IsNull(local!endDate),
              local!startDate > local!endDate
            ),
            null(),
            if(
              and(
                local!startDate - 1 < fv!item.periodStart,
                fv!item.periodEnd < local!endDate + 1
              ),
              fv!index,
              null
            )
          )
        )
      ),
      local!idx: union(
        local!idx1,
        local!idx2,
        tointeger(local!idx3)
      ),
      local!filteredData: a!forEach(
        items: local!idx,
        expression: { local!actualData[fv!item] }
      ),
      {
   
        a!sectionLayout(
          label: "Customer DATA",
          contents: {
           a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    rule!PNK_DropDownForCustomerSelection(
                      customerName: local!customerName,

                      customerNameSelection: local!customerNameSelection,
                      customerAddress: local!customerAddress,
                      customerAddressSelection: local!customerAddressSelection
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    rule!PNK_DateComponentFilters(
                      requestStartDate: local!startDate,
                      requestEndDate: local!endDate
                    )
                  }
                )
              }
            ),
            a!gridField(
              label: "",
              labelPosition: "ABOVE",
              data: if(
                fn!IsNull(local!idx),
                local!actualData,
                local!filteredData
              ),
              columns: {
               
                a!gridColumn(
                  label: "Name",
                  value: fv!row.customerName
                ),
                a!gridColumn(
                  label: "Address",
                  value: fv!row.customerAddress
                ),
                a!gridColumn(
                  label: "Start Date",
                  value: fv!row.periodstart
                ),
                a!gridColumn(
                  label: "End Date",
                  value: fv!row.periodend
                )
              },
             
              selectable: true,
              selectionStyle: "CHECKBOX",
              selectionValue: local!selection,
              selectionSaveInto: local!selection,
              selectionRequired: true,
              validations: {}
            )
          }
        ),
        
      }
    )

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data