How to display the unique values through code
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 07:56 AM
Hi Team,
Can anyone help me on below requirement.
I want to display the approver manager list, but in my code, I am getting the same manager three times. So, I wanted to eliminate those duplicate values through code, and I used the Glide record class.
Thanks,
Sasipriya.
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 08:06 AM
Hi,
If you have the managers in an array, you can use the built in function to retrieve unique values.
Like so:
var fruits = ['banana', 'apple', 'orange', 'apple', 'banana', 'banana'];
var util = new global.ArrayUtil();
var uniqueFruits = util.unique(fruits);
gs.info('fruits: ' + fruits);
gs.info('unique values: ' + uniqueFruits);
// *** Script: fruits: banana,apple,orange,apple,banana,banana
// *** Script: unique values: orange,apple,banana