Skip to main content
February 20, 2023
Question

A Question for Filtering Record Data

  • February 20, 2023
  • 4 replies
  • 0 views

Hi Appian Guys,



a!queryRecordType
( recordType: recordType!SellerTeam, filters: a!queryFilter( field: recordType!SellerTeam.fields.sellerName, # example value is "Alex; Alexis" operator: "includes". value: "Alex" ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500) )


I want to get teams of including "Alex" only, could anyone give me some good advises?

4 replies

stefanhelzle0001
Brainy
February 20, 2023

If your values are semicolon separated names, this becomes complicated. Searching for "Alex;" would only work as long as that name is not at the end.

Is this a one-to-many relationship? If you put the names in a separate record, your task would be simple.

qiweiyAuthor
February 20, 2023

Indeed, it is a one-to-many relationship, but I can't change the data structure.

harshitb6843
February 20, 2023

a!queryRecordType(
  recordType: recordType!SellerTeam,
  filters: a!queryLogicalExpression(
    operator: "OR",
    filters: {
      a!queryFilter(
        field: recordType!SellerTeam.fields.sellerName,   # example value is "Alex; Alexis"
        operator: "includes",
        value: "Alex;"
      ),
      a!queryFilter(
        field: recordType!SellerTeam.fields.sellerName,   # example value is "Alex; Alexis"
        operator: "ends with",
        value: "Alex"
      )
    }
  ),
  pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500)
)

qiweiyAuthor
February 21, 2023

That's great!! but i added two conditions for entire logic.

a!queryRecordType(
recordType: recordType!SellerTeam,
filters: a!queryLogicalExpression(
operator: "OR",
filters: {
a!queryFilter(
field: recordType!SellerTeam.fields.sellerName, # example value is "Alex; Alexis"
operator: "includes",
value: "; Alex;"
),
a!queryFilter(
field: recordType!SellerTeam.fields.sellerName, # example value is "Alex; Alexis"
operator: "ends with",
value: "; Alex"
),

a!queryFilter(
field: recordType!SellerTeam.fields.sellerName, # example value is "Alex; Alexis"
operator: "=",
value: "Alex"
),

a!queryFilter(
field: recordType!SellerTeam.fields.sellerName, # example value is "Alex; Alexis"
operator: "starts with",
value: "Alex; "
),
}
),
pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500)
)