简体   繁体   中英

Suitescript saved search without duplicates

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 !

在您的custrecord_uc_submarketlabel列上使用 GROUP 摘要。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM