Skip to main content
stephenk0001
Known Participant
Aug 24, 2023 2:04 PM UTC
Solved

In a queryEntity expression, is it possible to filter on both a primary entity and a related entity?

Here is a very rough ERD:



Each case has many subcases; each subcase deals with a software and each software has a status 

I have a Rule Input "dcmCaseID" that is populated with the parentCaseID for the Case entity.

When the query is run, I get data for all the subcases that are linked to the case ID

The query looks something like this:

a!queryEntity(
entity: cons!DSE_SUBCASE,
query: a!query(
logicalExpression: a!queryLogicalExpression(
operator: "AND",
filters: {
a!queryFilter(
field: "case.parentID",
operator: "=",
value: ri!dcmCaseID
)
},
ignoreFiltersWithEmptyValues: false
),
pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1)
),
fetchTotalCount: false
).data,

I need to modify the query to return only subcases where the software statusID is null.

Using a queryRecordType either breaks the process completely, or returns no subcases at all.

Any help will be greatly appreciated!

Blessings

Stephen

mikes0011
mikes0011Answer
Brainy
Aug 24, 2023 2:52 PM UTC

You would simply include multiple a!queryFilter() entries in your logicalExpression's filters list.

Also:

The Expression Guru

3 replies

mikes0011
mikes0011Answer
Brainy
Aug 24, 2023 2:52 PM UTC

You would simply include multiple a!queryFilter() entries in your logicalExpression's filters list.

Also:

The Expression Guru
stephenk0001
Known Participant
Aug 29, 2023 7:02 AM UTC

Thanks Mike, that did the trick!

mikes0011
Brainy
Aug 29, 2023 1:34 PM UTC

Cool, thanks for confirming!

The Expression Guru