Skip to main content
June 28, 2023
Question

Querying based on list of pairs

  • June 28, 2023
  • 1 reply
  • 0 views

Table I want to query's structure
DOCUMENT

{

docName

docDesc

color

size

priority

}

I have a list of {{ pickle.doc, blue}, { habenaro.doc, green}} I want to use to query the table with.

Is there a way to do this in a single query? My list is of the form {docName, color}, none of these combos are unique.  I could get back 20 entries and still be fine with that solution.

1 reply

mathieud0001
Brainy
June 28, 2023

I believe it would look something like this:

a!localVariables(
  local!docNameColors: {
    {
      docName: "pickle",
      color: "green"
    },
    {
      docName: "habanero",
      color: "blue"
    }
  },
  a!queryRecordType(
    recordType: recordType!Document,
    filters: a!queryLogicalExpression(
      operator: "OR",
      logicalExpressions: {
        a!forEach(
          items: local!docNameColors,
          expression: {
            a!queryLogicalExpression(
              operator: "AND",
              filters: {
                a!queryFilter(
                  field: "recordField!docName",
                  operator: "=",
                  value: fv!item.docName
                ),
                a!queryFilter(
                  field: "recordField!color",
                  operator: "=",
                  value: fv!item.color
                )
              }
            )
          }
        )
      }
    ),
    pagingInfo: a!pagingInfo(1, 5000)
  )
)