How to restrict records in Database view using before query business rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 10:10 PM
Hi Community,
In the below database view, I want to display certain records based on a condition.
Condition:- If in one location there are multiple Membership Status, then only Membership status starts with 'Member' can be displayed on list and other records not need to be displayed.
Example:- For location 'Taiwan' ,there are 3 records. So only two records where Membership status is 'Member- Full Scope' should be shown.
Can someone please help how this can be achieved from Before Query business rule?
Thanks,
Ankita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 12:36 AM
Hi @Ankita Kolhe ,
As per my understanding if location is "India", you need to show Result with B
so can you please try to "setLimit" like
Please mark correct and helpful if it wokrs for you
Thanks and Regards
Sarthak

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 12:20 AM
Hello,
In condition tab of Business rule pls add both condition if you want to trigger BR on that condition .
Like : entity location is Taiwan and
membership status is Member - Full Scope.
But if you want to do query the table based on above condition you will have to write encoded Query as
current.addEncodedQuery('entity_location!=Taiwan^ORmembership_status =='Member_Full_Scope');
pls check actual value of field n add it Query.
If my answer is helpful pls mark helpful and correct !
Thank You.
Br,
Pratiksha,k
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 12:30 AM
Hi @Pratiksha Kalam ,
Thanks for your response. However my requirement is bit different here.
It's just not for particular condition that needs to be applied based on locations and Membership Structure.
Let's have below examples:-
Membership Status 'A' always takes precedence over 'B' & 'B' over 'C'.
Example-1
So suppose we have three records where Location is 'Australia'.
Record1- Membership Status - A
Record2- Membership Status -B
Record3- Membership Status -C
Result- A (only one record should display where Membership Status is A)
Example-2
So suppose we have two records where Location is 'India'.
Record1- Membership Status -B
Record2- Membership Status -C
Result- B (only one record should display where Membership Status is B)
Hope it's clear now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 04:09 AM
Hi @Ankita Kolhe ,
You can try creating before query business rule on table which got created on database view with your encoded query condition.
Please mark my response helpful if it resolves your issue!