Reputation: 31
Hi I am in need of a saved search that does not return duplicate Submarket Labels. Reason is because this search returns like 24000 entries, but there are only like 10 submarket labels. I just need to pull what those individual labels are as strings (no duplicates) because i am comparing it to the submarket of the current ama.
var ama_search = search.create({
type: 'customrecord_uc_ama',
filters: [{
name: 'isinactive',
operator: search.Operator.IS,
values: false,
}],
columns: ['custrecord_uc_submarketlabel']
});
//what i want to do
var all_submarketlabels = []
ama_search.run().each(function(result){
if (result.custrecord_uc_submarketlabel not in all_submarketlabels) {
all_submarketlabels.push(result.custrecord_uc_submarketlabel)
}
}))
and all_submarketlabels would hold... all of the submarket labels ex: ['New York','Westchester','Los Angeles'] etc. and it would return TRUE if my AMA's submarket was 'New York'
How can this be done ?
Once again, my current search returns 24k+ entries and maximum is 4000, so how can i make a lesser amount of yielded results ?
Putting it simply, I want a saved search on all AMA's so that i can get all possible values of Submarket Label and put it into an array. i would then compare my ama's submarket label to see if it is inside said array
THANKS !
Upvotes: 1
Views: 263
Reputation: 8847
Use a GROUP summary on your custrecord_uc_submarketlabel
Column.
Upvotes: 2