- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 12:20 PM
Hi Experts,
I have queried value of a field (in my case from Location field) and stored in a variable like var rec = current.location.name.toString();
Now I want to compare that string which I got in rec if that is CONTAINED in other table's field (field name is Area because they are not exact matching but the string in Area contains the characters which I got in rec.
Will indexOf(rec)>-1 work i mean putting the variable name instead of actual string in it or how does it please guide.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 12:30 PM
Hi,
function ifScript() {
var Area = current.variables.requested_for.location.getDisplayValue();
if (Area .toString().indexOf('UKBAS1') >= 0) {
// instead of "UKBAS1" string part you can specify your string which is common in both the fields
return 'yes';
}
return 'no';
}
if my response helps you please hit and mark as correct answer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 12:23 PM
Yes, putting it in form
yourAreafield.indexOf(rec)>-1 should work as -1 is a search for Contains
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 12:30 PM
Hi,
function ifScript() {
var Area = current.variables.requested_for.location.getDisplayValue();
if (Area .toString().indexOf('UKBAS1') >= 0) {
// instead of "UKBAS1" string part you can specify your string which is common in both the fields
return 'yes';
}
return 'no';
}
if my response helps you please hit and mark as correct answer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2020 06:09 AM
HI
Good solution. Why not directly put the "rec" variable, where you have the "'UKBAS1" string...
Then, you've got it.
BR
Dirk