Feature(s) impacted
On Workspace, Filtering a collection “Transactions” to list only records related to the selected user record
Observed behavior
when the “stripe_id” of the selected user is null i got this error:
This should show the transactions related to user.
The collection filter :
Failure Logs
How can I let it filter even when the value “stripe_id” of some users is null?
- Project name: …
- Team name: …
- Environment name: …
- Agent technology: (nodejs, php, rails, python)
- Agent (forest package) name & version: …
- Database type: …
- Recent changes made on your end if any: …
Hello @Adel_de_Clevermate,
As you’ve seen the validator on the agent is quite strict but this is to provide a better UX when using filters and whatnot.
However I understand your issue and I’ll see what we can do to mitigate this. I’ll keep you updated when I have more to share.
1 Like
Hello @Adel_de_Clevermate,
We decided to categorise this as a bug on the agent side, and a fix will be released ASAP, as always, I’ll inform you when it is released 
Best regards,
The fix is available on the latest release of the @forestadmin/agent: "1.58.3"

Thanks for the report 
1 Like
@dogan.ay
I just noticed that with the same filter above, when I select a user with stripe_id=null it lists all the transactions in DB (which is not the goal) it should list zero records.
Can you confirm this please?
Thanks.
I do not observe the same behaviour.
It should apply the exact condition you are expecting based on the filters you have defined:
transactions.stripe_id IS NULL OR transactions.userId = {{contacts.selectedRecord.id}}
Please make sure that you are selecting only one record from your contacts
collection component if not the filter will not be applied.
You can edit the visibility of your transaction
collection component (collection3) to only be visible when the dynamic value is defined (only when 1 record is selected)
Hi @dogan.ay thank you for your response.
Actually the filter applied is :
when stripe_id is null and no transaction matchs the selected user_id we should have empty result, however it still shows all transactions records instead.
I checked that there is only one user record selected and I used the option to only be visible when the dynamic value is defined.
Using “@forestadmin/agent”: “^1.58.3”,
Could you share the payload of the list call that is made in your network tab when the collection is retrieved ? The dynamic values in this case are resolved in your browser, you should see the final filter that is executed on the call.
You might as well want to check that the component contact_list_new
is still defined in your workspace, a rename could cause issues.
After checking on the network logs, I see that It was actually taking stripe_id IS NULL OR userId = {{contacts.selectedRecord.id}}
since the selected user has not stripe_id I think this what gives that result.
To fix this I should change the condition to (transactions.stripe_id IS NOT NULL AND transactions.stripe_id={{contacts.selectedRecord.customer_id}}) OR transactions.userId = {{contacts.selectedRecord.id}}
However I can’t find a way to do it through the UI, I wonder if you have an idea on how to implement this condition (using the UI or on the code)?
Thank you!
Sadly there is still no way to combine AND and OR operators in the UI today, so no easy solution:
If you still want to do it with the UI, you could have 2 collection components:
- one with the condition transactions.stripe_id IS NOT NULL AND transactions.stripe_id={{contacts.selectedRecord.customer_id}} , and only visible if contacts.selectedRecord.customer_id IS NOT NULL
- and the second collection with the condition transactions.userId = {{contacts.selectedRecord.id}}, only visible if contacts.selectedRecord.customer_id IS NULL
But this is not optimal as you would have two collection component for transaction and they wouldn’t display at the same location.
If you are not against using code, you can override the search on your collection to detect the exact condition tree sent by this workspace component and replace it with the one you just shared.
1 Like