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-11-2024 11:06 PM
Hi @Ankita Kolhe ,
Yes, you can write something similar in there clause after existing clause: && membership_status == 'Member - Full Scope'.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 12:24 AM
Hi @AndersBGS ,
Thanks for your response. However my requirement is bit different here.
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-11-2024 11:37 PM
Hi @Ankita Kolhe ,
I tried your problem on my PDI and I hope below answer works for you !
I created a query BR on Incidnet table (You can create on any table you want) and add below code
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.addEncodedQuery('short_description!=Test^ORshort_description=NULL');
})(current, previous);
Here you can give like
Result After :
This remove short desc starts with Test
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:23 AM - edited 04-12-2024 12:24 AM
Hi @Community Alums ,
Thanks for your response. However my requirement is bit different here.
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.