- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2018 03:37 AM
i used the below script in the if condition..
answer = ifScript();
function ifScript() {
var country = current.variables.country;
if (country!='10'||country!='3'||country!='4'||country!='15'||country!='16'||country!='21')
{
gs.log(country.getDisplayValue());
return 'yes';
}
return 'no';
}
when i give country value as 3 in the catlog variable it returnzz 'yes'
can i know why?
in gs.log the value is passing correctly.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2018 03:51 AM
Hello,
You can try below code
Note: Please mark reply as correct if it answers your question.
answer = ifScript();
function ifScript() {
var country = current.variables.country;
var countries = [
'10',
'3',
'4',
'15',
'16',
'21'
];
var aru = new ArrayUtil();
if (aru.indexOf(country) == -1) {
gs.log(country.getDisplayValue());
return 'yes';
}
return 'no';
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2018 03:42 AM
Since you have given OR condition, suppose if you have given value as 3 also, because of OR condition, it will give value as Yes only, because other condition are passing right..example..Value is not 10 like that.
OR may not work correctly for your requirement.
if (country!='10'||country!='3'||country!='4'||country!='15'||country!='16'||country!='21')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2018 03:51 AM
Hello,
You can try below code
Note: Please mark reply as correct if it answers your question.
answer = ifScript();
function ifScript() {
var country = current.variables.country;
var countries = [
'10',
'3',
'4',
'15',
'16',
'21'
];
var aru = new ArrayUtil();
if (aru.indexOf(country) == -1) {
gs.log(country.getDisplayValue());
return 'yes';
}
return 'no';
}