- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2016 07:44 PM
Folks, I have checked almost all the options for having another data type but looks like 'list collector' is the only available data type for selecting multiple values. But my requirement is there are 2 'list collector' variables and with this data type you can only select 1 variable. If you select another the previous one gets over-written. Something like this below:
Now, if I want to order 2 VAR 1's in the same SCREQ, it wouldn't allow as the VAR 1 variable only stores the most recent selection. Is there any way to overcome this as this seems to be a very critical requirement and using check-boxes doesn't seem like the best possible option as there are 64 records in the table that VAR 1 is referencing.
Thanks in advance !!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2016 04:03 AM
Try this 😃
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
//Name of the list collector that the filter shall apply on
var collectorName = 'users';
//If the newValue isn't empty, build the filter
if( newValue != '') {
//Lets split up the string into an array
var answer = newValue.split(',');
var filterString = [];
//First filter shouldnt start with an "or" so lets set it here with the first value
filterString = 'department=' + answer[0];
//If there is selected more than one department, put those in as "OR" conditions
if(answer.length > 1){
for (var i=1; i<answer.length;i++){
filterString += '^ORdepartment=' + answer[i];
}
}
eval(collectorName + 'g_filter.reset()');
eval(collectorName + 'g_filter.setQuery("' + filterString + '")');
eval(collectorName + 'acRequest(null)');
}
//If the newValue is empty, just reset the filter
else{
eval(collectorName + 'g_filter.reset()');
eval(collectorName + 'acRequest(null)');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 04:49 PM
So does it look something like this below :
//variable - database_name sysID : 7e3d54140fd70a0097be5c3be1050e18
//variable - database_role sysID : 4fddd8d00fd70a0097be5c3be1050e2c
// Set the list collector name
var collectorName = '7e3d54140fd70a0097be5c3be1050e18,4fddd8d00fd70a0097be5c3be1050e2c',
flag = true,
filterString = 'u_application_name=' + g_form.getValue('application_name') + '^u_database_nameIN' + g_form.getValue('database_name') + ''; // Create a filter to the be applied to the list collector variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 05:38 PM
Oops I understood it wrong, I haven't changed the script yet. But when I added more than 1 database in the first list collector, the filter value gets changed to the sysIDs, something like this - 3016666d0ffc56007038b57ce1050ec1,5516666d0ffc56007038b57ce1050ef5. Now if there is only 1 database value, the filter gets changed to a proper database role value.
I have changed the filter to this now : filterString = 'u_application_name=' + g_form.getValue('application_name') + '^ORu_database_nameIN' + g_form.getValue('database_name') + ''; still seeing the separated list of sysIDs of the selected database values in the first list collector...
Can you guys please help me out with the right filter string that I can use in my catalog client script ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2016 11:53 PM
I'm just throwing ideas here and haven't done it myself.
Perhaps create this in a macro and put that as a macro variable on the catalog item. Then if needed have a onSubmit script taking the data and put it in a hidden variable for further use.
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2016 04:03 AM
Try this 😃
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
//Name of the list collector that the filter shall apply on
var collectorName = 'users';
//If the newValue isn't empty, build the filter
if( newValue != '') {
//Lets split up the string into an array
var answer = newValue.split(',');
var filterString = [];
//First filter shouldnt start with an "or" so lets set it here with the first value
filterString = 'department=' + answer[0];
//If there is selected more than one department, put those in as "OR" conditions
if(answer.length > 1){
for (var i=1; i<answer.length;i++){
filterString += '^ORdepartment=' + answer[i];
}
}
eval(collectorName + 'g_filter.reset()');
eval(collectorName + 'g_filter.setQuery("' + filterString + '")');
eval(collectorName + 'acRequest(null)');
}
//If the newValue is empty, just reset the filter
else{
eval(collectorName + 'g_filter.reset()');
eval(collectorName + 'acRequest(null)');
}
}