- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2018 11:12 AM
I have a list collector variable on the sys_user table in a catalog item and I want to update the filter on the collector based on a selection of a drop down on the catalog item. I can do this as a catalog client script but I am having trouble setting the encoded query.
I want to encode 2 things
- show only users whose manager is the current user (i.e. requestor).
- The requestor chooses expires in 30, 60, or 90 days from a drop down list. I need to show users that have u_expires date field less than 30/60/90 days from now.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2018 01:29 PM
OK, actually, we should be able to accomplish this without a Client Script:
1. set the Reference qualifier for the List Collector to the following:
javascript:"active=true^u_user_type=Consultant^manager=" + gs.getUserID() + "^u_expiresRELATIVELT@dayofweek@ahead@" + current.variables.number_of_days;
2. set the "Variable attributes" field for the List Collector to the following:
ref_qual_elements=number_of_days
The "ref_qual_elements" attribute will send back to the server the current values for those variables so they can be used in the reference qualifier.
Replace "number_of_days" in both the Reference qualifier and the "Variable attributes" field with whatever your variable name is.
I tried it in my dev instance with "Company" and "Users" variables and the Users list collector changes based on the selected company. In both the regular and portal UIs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2018 12:41 PM
This article should help with that - Changing the Filter of a List Collector Variable via Client Script (SNGuru)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2018 12:46 PM
Jim -
I tried this article already and for whatever reason it does not change my filter. I was wondering if you have a pre-defined ref qualifier on the variable it wont work. I may try to remove it and see what happens. Or maybe as the qualifier I can just call the catalog client script?
Here is what I had - I just started with a basic filter of show me everyone - but it didnt work.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.setValue('choose_contractors_to_extend_or_disable', ''); //this will clear out the list collector
var collectorName = 'choose_contractors_to_extend_or_disable';
var filterString = 'active=true'; //I will change this
setCollectorFilter();
function setCollectorFilter(){
//Reset the filter query
var myListCollector = g_list.get(collectorName);
myListCollector.reset();
myListCollector.setQuery(filterString);
} }
PS - I tried the other way with window command as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2018 11:37 AM
This article may help you to build the query - Generate an encoded query string through a filter.
You just have to replace the values with any variables, etc...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2018 01:29 PM
OK, actually, we should be able to accomplish this without a Client Script:
1. set the Reference qualifier for the List Collector to the following:
javascript:"active=true^u_user_type=Consultant^manager=" + gs.getUserID() + "^u_expiresRELATIVELT@dayofweek@ahead@" + current.variables.number_of_days;
2. set the "Variable attributes" field for the List Collector to the following:
ref_qual_elements=number_of_days
The "ref_qual_elements" attribute will send back to the server the current values for those variables so they can be used in the reference qualifier.
Replace "number_of_days" in both the Reference qualifier and the "Variable attributes" field with whatever your variable name is.
I tried it in my dev instance with "Company" and "Users" variables and the Users list collector changes based on the selected company. In both the regular and portal UIs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2018 02:52 PM
Awesome. Thanks!
That
ref_qual_elements=
is a nice trick.