- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 09:10 AM
Hi All,
I am implementing scenario of transform map script in which I need to check if category array contains element of source category and perform few tasks . But in attachment at 12 number line index is always return -1 even if element is present in categoryArr. Could someone please help this why it is returning always -1?
Thanks,
Tara Singh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 01:51 PM - edited 04-04-2024 01:54 PM
As you mentioned your array is: Legal, Direct, Indirect
Hence your input value is "Direct" but your array contains " Direct"... leading space 🙂
But why convert to array? Try below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 09:47 AM
Hi @Tarasingh26 ,
Did you try logging the variable categoryArr and checking its value?
Thankyou.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 12:35 AM
Values in categoryArr are coming correct. And source category field value is also there in categoryArr array but still it is returning -1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 10:36 AM - edited 04-04-2024 10:36 AM
@Tarasingh26 : Have you checked if there are any white spaces in the array values. If so, try removing those spaces.
Thankyou.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 12:37 AM