Hello,
I'm using function a!recordData to return data from one of my records and I need to apply multiple filtering on the dataset:
data: a!recordData( recordType: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}QUA Incident', filters: { a!queryFilter( field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}QUA Incident.fields.{a1a9fdf7-1d9b-48eb-a147-2a233271d74b}adGroup', operator: "=", value: local!adGroup ), a!queryFilter( field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}QUA Incident.fields.{3729b606-5b1b-4fb8-b16b-c9e929833ece}assignedTo', operator: "<>", value: loggedInUser() ) } )
When I use both filters, data is not appearing at all, If I remove the second condition I can see some results that are aligned with the first filter definition.
However, If I use a!queryEntity function to retrieve the same data for the same entity I get 2 results ( the expected result).
a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "adGroup", operator: "=", value: "GS-A2-CAPF-BPM-QUA-Bendern-Accountants" ), a!queryFilter( field: "assignedTo", operator: "<>", value: loggedInUser() ) }, ignoreFiltersWithEmptyValues: true )
Can anyone please explain what could be the reason for not getting the same result with both approaches ?
Discussion posts and replies are publicly visible
Check if there is any source filter applied to your Record Type which is filtering out the records you are trying to fetch in a!recordData
Hello / Mike Schmitt,
I don't have any source filter defined. Please see below:
I'm just trying to understand the reason for not getting the data with a!recordData and a!queryRecordType is not returning the data as well:
a!queryRecordType( recordType: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}QUA Incident', filters: { a!queryFilter( field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}QUA Incident.fields.{a1a9fdf7-1d9b-48eb-a147-2a233271d74b}adGroup', operator: "=", value: local!adGroup ), a!queryFilter( field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}QUA Incident.fields.{3729b606-5b1b-4fb8-b16b-c9e929833ece}assignedTo', operator: "<>", value: loggedInUser() ) }, pagingInfo: a!pagingInfo(1,5000) )
Any idea apart from what we discussed already ? I'm a little bit lost, cannot find a logic reason for what is happening.
Can you clarify what values exist in the DB which aren't getting returned when you run this, which you feel should be getting returned?
So basically I want to return row 2:
I'm passing the AD GROUP as "Bendern" and I don't want to consider the ones that are assigned to my user = row2
Oh - your issue is probably filtering on "<>" for a text column when the row in question has a NULL (or non-null but empty) value. It doesn't always behave how you think it might. And from this, I'm guessing it might behave differently between a!queryEntity and a!recordData.
That was exactly the problem. Thank you so much Mike
Ok great, thanks for confirming
Nice observation there, but I tried doing the same with a!queryEntity and it turns out that the behaviour is same i.e., "<>" will only look for not null values.
So we need to apply a filter to get all null values also for this particular use case, either it is a!queryentity() or a!recordData() or a!queryRecordType()
a!recordData( recordType: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}', filters: a!queryLogicalExpression( operator: "AND", filters: a!queryFilter( field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}.fields.{a1a9fdf7-1d9b-48eb-a147-2a233271d74b}', operator: "=", value: local!adGroup ), logicalExpressions: a!queryLogicalExpression( operator: "OR", filters: { a!queryFilter( field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}.fields.{3729b606-5b1b-4fb8-b16b-c9e929833ece}', operator: "is null" ), a!queryFilter( field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}.fields.{3729b606-5b1b-4fb8-b16b-c9e929833ece}', operator: "<>", value: loggedInUser() ) } ) ) )
Keen to know if there is any other solution to it.
Hi Sanchit this approach works as well. thank you for your help