Compare Joined String to an Array in a Query Filter

I am trying to compare a field that is a joined array of customer locations (ex: "Factory A; Factory X; Factory Y") to an array locations put in as a filter (user selects "Factory X"). Essentially what I would like to have happen is if any part of this array {"Factory X", "Factory Z"} is present in this field "Factory A; Factory X; Factory Y" then I'd like to return that record.

Is this possible?

OriginalPostID-259947

  Discussion posts and replies are publicly visible

Parents
  • As far as i understood, you will provide input as single string "Factory A; Factory X; Factory Y" and you are expecting to search any matches which have any of those factories. if that is the case you code must be like as follows

    local!searchItems:fn!split("FACTORY A;FACTORY B;FACTORY C",";"),

    /*-----


    a!queryEntity(
    entity:----
    a!query(
    -----

    */

    logicalExpression:if(rule!APN_isEmpty(local!searchItems),{},a!queryLogicalExpression(
    operator: "OR",
    filters: {
    a!applyComponents( a!queryFilter(
    field: "field",
    operator: "=",
    value: _
    ),local!searchItems)
    }
    )

    You can apply any number of query filters on same field with proper conditions it works. Let me know if you need any help.
Reply
  • As far as i understood, you will provide input as single string "Factory A; Factory X; Factory Y" and you are expecting to search any matches which have any of those factories. if that is the case you code must be like as follows

    local!searchItems:fn!split("FACTORY A;FACTORY B;FACTORY C",";"),

    /*-----


    a!queryEntity(
    entity:----
    a!query(
    -----

    */

    logicalExpression:if(rule!APN_isEmpty(local!searchItems),{},a!queryLogicalExpression(
    operator: "OR",
    filters: {
    a!applyComponents( a!queryFilter(
    field: "field",
    operator: "=",
    value: _
    ),local!searchItems)
    }
    )

    You can apply any number of query filters on same field with proper conditions it works. Let me know if you need any help.
Children
No Data