SEARCH entire grid

Hi,

How can I make a SEARCH field to look up keywords to filter an entire grid rather than filter by just one column field of the grid? If a recipe exists on this topic, that would also be helpful. Thanks!

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Senior Developer

    Morgan,

     

    If you were to have a table with 3 columns (i.e Value1, Value2, Value3) then you could run a value such as local!searchTerm against all 3 within a query entity using the operator 'includes' in order to check all potential columns data vs the search term.

    Local!searchTerm could be written to via a text field where the user could input whatever value they want to filter by. 

    See below for an example query entity:

    local!datasubset: a!queryEntity(
    entity: cons!DSE,
    query: a!query(
    selection: a!querySelection(
    columns: {
    a!queryColumn(field: "id"),
    a!queryColumn(field: "value1"),
    a!queryColumn(field: "value2"),
    a!queryColumn(field: "value3")
    }
    ),
    logicalExpression: if(
    isnull(local!searchTerm),
    /* If no search or filters have been used, don't filter the data in the query */
    null,
    a!queryLogicalExpression(
    operator: "OR",
    filters: {
    a!queryFilter(field: "value1", operator: "includes", value: local!searchTerm),
    a!queryFilter(field: "value2", operator: "includes", value: local!searchTerm),
    a!queryFilter(field: "value3", operator: "includes", value: local!searchTerm),
    }
    )
    ),
    pagingInfo: local!pagingInfo
    )
    )

     

    Jeremy Chen

Reply
  • +1
    Certified Senior Developer

    Morgan,

     

    If you were to have a table with 3 columns (i.e Value1, Value2, Value3) then you could run a value such as local!searchTerm against all 3 within a query entity using the operator 'includes' in order to check all potential columns data vs the search term.

    Local!searchTerm could be written to via a text field where the user could input whatever value they want to filter by. 

    See below for an example query entity:

    local!datasubset: a!queryEntity(
    entity: cons!DSE,
    query: a!query(
    selection: a!querySelection(
    columns: {
    a!queryColumn(field: "id"),
    a!queryColumn(field: "value1"),
    a!queryColumn(field: "value2"),
    a!queryColumn(field: "value3")
    }
    ),
    logicalExpression: if(
    isnull(local!searchTerm),
    /* If no search or filters have been used, don't filter the data in the query */
    null,
    a!queryLogicalExpression(
    operator: "OR",
    filters: {
    a!queryFilter(field: "value1", operator: "includes", value: local!searchTerm),
    a!queryFilter(field: "value2", operator: "includes", value: local!searchTerm),
    a!queryFilter(field: "value3", operator: "includes", value: local!searchTerm),
    }
    )
    ),
    pagingInfo: local!pagingInfo
    )
    )

     

    Jeremy Chen

Children
No Data