Create a filter using Text Field to fetch the particular details in grid

Hi ,

Actually , I have argent requirement that i need to create a filter using text field but I'm not able to archive ... 

here is my code  

load(
  local!fetch,
  local!pagingInfo:a!pagingInfo(
    startIndex:1, 
    batchSize: cons!batch_no, 
    sort:a!sortInfo( field:"projId", ascending:true())),
    
    
  
with(
  local!StudentsData:a!queryEntity(
  entity:cons!RQA_double_item_ENTITY, 
  query:a!query(
    filter:a!queryFilter(
      field:"field", 
      operator:"=", 
      value:ri!PorjectID
    ),
    pagingInfo:local!pagingInfo
    
  ),
  fetchTotalCount: true()
),
{
  a!sectionLayout(
      label: "Fetch Details",
      contents: {
        a!columnsLayout(
          columns: {
          a!columnLayout(
            contents: {
            
              a!textField(
                label: "Students ID",
                required: true(),
                value: local!fetch,
                saveInto: local!fetch
               
              ),
            a!buttonArrayLayout(
              buttons: {
                a!buttonWidget(
                  label: "Search",
                  value: local!fetch,
                  submit: true()
                  
                  
                )
              },
              align: "START"
            )
     
           } 
          ),
          }
        )
    }
    ),
a!sectionLayout(
      label: "Students Details",
      contents:{ 
if(rule!RQA_checkIsNullOrEmpty(local!StudentsData),
a!richTextDisplayField(label:"",value: "No Data Available"),
a!gridField(
  label: "",
 
  totalCount:local!StudentsData.totalCount,
  
  
  columns: {
    if(rf!requesttype=cons!RQA_VALUES[1],
    a!gridTextColumn(
      label: "Students ID",
      field: "student",
      data: index(local!StudentsData.data,"student",{}),
      alignment: "CENTER"
   ),{}),
   a!gridTextColumn(
     label: "ClassID",
     field: "classid",
     data: index(local!StudentsData.data,"classid",null),
     alignment: "CENTER"
     ),
   ...
   ..
   ..
   ...
   ..
   ..
   ..
       },
     value: local!pagingInfo,
      saveInto: local!pagingInfo,
      rowHeader: 1
          /*selection: true()*/
)
 )
},
isCollapsible:true())
}
)

)

  Discussion posts and replies are publicly visible

Parents
  • Hi 

    So you need to filter on two fields PorjectID and StudentId. for multiple filters you need to use a!queryLogicalExpression() in your query entity like 

    a!queryEntity(
    entity: cons!RQA_double_item_ENTITY,
    query: a!query(
    pagingInfo: local!pagingInfo,
    logicalExpression: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    a!queryFilter(
    field: "field",
    operator: "=",
    value: ri!PorjectID
    ),
    if(
    isnull(
    local!fetch
    ),
    {},
    a!queryFilter(
    field: "StudentId",
    operator: "=",
    value: local!fetch
    )
    )
    }
    )
    ),
    fetchTotalCount: true()
    )

  • dude i need to filter one row in grid field ...  using text filter .. how i can configure 

  • By using text filter you need to sort one  row in grid field?

    Based on text which you have entered in text filed the sort has to apply for the grid correct ?

    please correct me if i am wrong 

  • load(
      local!field,
      local!ascending: true(),
      local!pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: - 1,
        sort: a!sortInfo(
          field: if(
            isnull(
              local!field
            ),
            "id",
            local!field
          ),
          ascending: local!ascending
        )
      ),
      local!sampleData: {
        {
          name: "ABC",
          id: 2
        },
        {
          name: "XYZ",
          id: 1
        }
      },
      {
        a!textField(
          label: "Field",
          value: local!field,
          saveInto: {
            local!field,
            a!save(
              local!pagingInfo,
              a!pagingInfo(
                startIndex: 1,
                batchSize: - 1,
                sort: a!sortInfo(
                  field: local!field,
                  ascending: local!ascending
                )
              )
            )
          }
        ),
        with(
          local!datasubset: todatasubset(
            local!sampleData,
            local!pagingInfo
          ),
          local!dataForCurrentPage: local!datasubset.data,
          {
            a!gridField(
              label: "",
              totalCount: length(
                local!sampleData
              ),
              columns: {
                a!gridTextColumn(
                  label: "Name",
                  field: "name",
                  data: local!dataForCurrentPage.name,
                  alignment: "LEFT"
                ),
                a!gridTextColumn(
                  label: "ID",
                  field: "id",
                  data: local!dataForCurrentPage.id,
                  alignment: "LEFT"
                )
              },
              value: local!pagingInfo,
              saveInto: local!pagingInfo
            )
          }
        )
      }
    )

    check given code ,first by default it will sort on id  and if you give any value in text filed then it will sort on that value 

  • 
    load(
      local!fetch,
      local!pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: cons!batch_no,
        sort: a!sortInfo(
          field: if(
            rule!APN_isEmpty(
              local!fetch
            ),
            "projId",
            local!fetch
          ),
          ascending: true()
        )
      ),
      with(
        local!StudentsData: a!queryEntity(
          entity: cons!RQA_double_item_ENTITY,
          query: a!query(
            filter: a!queryFilter(
              field: "field",
              operator: "=",
              value: ri!PorjectID
            ),
            pagingInfo: local!pagingInfo
          ),
          fetchTotalCount: true()
        ),
        {
          a!sectionLayout(
            label: "Fetch Details",
            contents: {
              a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Students ID",
                        required: true(),
                        value: local!fetch,
                        saveInto: local!fetch
                      ),
                      a!buttonArrayLayout(
                        buttons: {
                          a!buttonWidget(
                            label: "Search",
                            saveInto: {
                              a!save(
                                local!pagingInfo,
                                a!pagingInfo(
                                  startIndex: 1,
                                  batchSize: cons!batch_no,
                                  sort: a!sortInfo(
                                    field: local!fetch,
                                    ascending: true()
                                  )
                                )
                              )
                            }
                          )
                        },
                        align: "START"
                      )
                    }
                  ),
                  
                }
              )
            }
          ),
          a!sectionLayout(
            label: "Students Details",
            contents: {
              if(
                rule!RQA_checkIsNullOrEmpty(
                  local!StudentsData
                ),
                a!richTextDisplayField(
                  label: "",
                  value: "No Data Available"
                ),
                a!gridField(
                  label: "",
                  totalCount: local!StudentsData.totalCount,
                  columns: {
                    if(
                      rf!requesttype = cons!RQA_VALUES[1],
                      a!gridTextColumn(
                        label: "Students ID",
                        field: "student",
                        data: index(
                          local!StudentsData.data,
                          "student",
                          {}
                        ),
                        alignment: "CENTER"
                      ),
                      {}
                    ),
                    a!gridTextColumn(
                      label: "ClassID",
                      field: "classid",
                      data: index(
                        local!StudentsData.data,
                        "classid",
                        null
                      ),
                      alignment: "CENTER"
                    ),
                    
                  },
                  value: local!pagingInfo,
                  saveInto: local!pagingInfo,
                  rowHeader: 1/*selection: true()*/
                  
                )
              )
            },
            isCollapsible: true()
          )
        }
      )
    )

Reply
  • 
    load(
      local!fetch,
      local!pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: cons!batch_no,
        sort: a!sortInfo(
          field: if(
            rule!APN_isEmpty(
              local!fetch
            ),
            "projId",
            local!fetch
          ),
          ascending: true()
        )
      ),
      with(
        local!StudentsData: a!queryEntity(
          entity: cons!RQA_double_item_ENTITY,
          query: a!query(
            filter: a!queryFilter(
              field: "field",
              operator: "=",
              value: ri!PorjectID
            ),
            pagingInfo: local!pagingInfo
          ),
          fetchTotalCount: true()
        ),
        {
          a!sectionLayout(
            label: "Fetch Details",
            contents: {
              a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Students ID",
                        required: true(),
                        value: local!fetch,
                        saveInto: local!fetch
                      ),
                      a!buttonArrayLayout(
                        buttons: {
                          a!buttonWidget(
                            label: "Search",
                            saveInto: {
                              a!save(
                                local!pagingInfo,
                                a!pagingInfo(
                                  startIndex: 1,
                                  batchSize: cons!batch_no,
                                  sort: a!sortInfo(
                                    field: local!fetch,
                                    ascending: true()
                                  )
                                )
                              )
                            }
                          )
                        },
                        align: "START"
                      )
                    }
                  ),
                  
                }
              )
            }
          ),
          a!sectionLayout(
            label: "Students Details",
            contents: {
              if(
                rule!RQA_checkIsNullOrEmpty(
                  local!StudentsData
                ),
                a!richTextDisplayField(
                  label: "",
                  value: "No Data Available"
                ),
                a!gridField(
                  label: "",
                  totalCount: local!StudentsData.totalCount,
                  columns: {
                    if(
                      rf!requesttype = cons!RQA_VALUES[1],
                      a!gridTextColumn(
                        label: "Students ID",
                        field: "student",
                        data: index(
                          local!StudentsData.data,
                          "student",
                          {}
                        ),
                        alignment: "CENTER"
                      ),
                      {}
                    ),
                    a!gridTextColumn(
                      label: "ClassID",
                      field: "classid",
                      data: index(
                        local!StudentsData.data,
                        "classid",
                        null
                      ),
                      alignment: "CENTER"
                    ),
                    
                  },
                  value: local!pagingInfo,
                  saveInto: local!pagingInfo,
                  rowHeader: 1/*selection: true()*/
                  
                )
              )
            },
            isCollapsible: true()
          )
        }
      )
    )

Children
No Data