How can I implement user filter like this

SELECT * FROM TABLE_A A JOIN TABLE_B B ON A.ID=B.A_ID WHERE B.ROLE IN ('ROLE1','ROLE2') and B.IS_ACTIVE=1

The relationship between A and B is one-to-many, two conditions should be matched in one row

I tried to do

{

queryfilter(Conditon1),

queryfilter(Condition2)

}

But it returned record A with two record B that match one of the conditions each

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    You can can try in the following way:

    a!queryRecordType(
      recordType: recordType!A,
      fields: {},
      filters: a!queryLogicalExpression(
        operator: "AND",
        filters: {
          a!queryFilter(
            field: recordType!A.relationships.B.fields.city,
            operator: "in",
    		value: {"New York", "Chicago"}
          ),
          a!queryFilter(
            field: recordType!A.relationships.B.fields.isActive',
            operator: "=",
            value: true
          )
        }
      ),
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 100
      )
    ).data

Reply
  • 0
    Certified Associate Developer

    You can can try in the following way:

    a!queryRecordType(
      recordType: recordType!A,
      fields: {},
      filters: a!queryLogicalExpression(
        operator: "AND",
        filters: {
          a!queryFilter(
            field: recordType!A.relationships.B.fields.city,
            operator: "in",
    		value: {"New York", "Chicago"}
          ),
          a!queryFilter(
            field: recordType!A.relationships.B.fields.isActive',
            operator: "=",
            value: true
          )
        }
      ),
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 100
      )
    ).data

Children
No Data