Check for unique match possible via indexOf()?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2017 07:23 AM
Hi,
I'm using a indexOf Function, but need to know if there is exactly only one match?
Something like
if (variable.indexOf(key) == 1) {
was what came into my mind ... but it does not work ;-(
Could you please help out?
Thank you
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2017 10:32 AM
This is the part that still confuses me:
i only want the group if there is only one match.
I auto assign group with this only if only one match for relevant group is found
If you are only interested in an exact match of 1, why do you care if anything else is returned - it doesn't sound like you're doing anything with it. What is the value of knowing the user is in two groups of type "X"?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2017 10:39 AM
If the user belongs to one incident group - I return the group
if user does not belong to any inc group or to more than one inc group I return nothing.
if an inc group is also from type problem is not relevant

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2017 08:23 AM
Hi,
Thanks for the clarification. Unfortunately my schedule does not permit me to dig in to this further. I believe the logic of counting records, filtering on types, etc is all there. You may have to re-arrange some pieces, but with some clever testing and debugging, I'm sure you can handle it from here.