The CreatorCon Call for Content is officially open! Get started here.

List collector results comparison question

Derek10
Tera Expert

Hi all

List collector results comparison question,


I'm looking to try to do a comparison of   the first 7 letters of a user's record location field, ex abc1234
and then compare it to a list collector that the user has selected to see if any contain the same data. for example:

user1 is from usajersey -
(it's a string so the query needs to stop before the -     example: usajersey - somecity)


they select from list collector a name like usaflorida - share \write.   This is the friendly name , not the actual name that i'm using for comparision.


but I only need the first characters before the -, on both the list collector and the user to be compared.

(not quite sure how to trim it down to look before. I tried doing the search '-' with no luck. Any thoughts? I'll give my psuedo coding example.

var userloc = current.variables.requested_for.location;

userloctrim = trimmed value;

//I'm wanting to search the entire selected list for matches

if (current.variables.listcollector.toString().indexOf('userloctrim') > -1) {  
workflow.scratchpad.match = 'true'
}
else
workflow.scratchpad.match = 'false'

So if it can't find the trimmed data from the user location it returns a false.

Any idea on how to approach this? Let me know if additional clarification is needed.

1 ACCEPTED SOLUTION

Derek,



  you will have to query 'sys_user_group' table for this. Dot walking will not work. here is the script for that


var gr1= new GlideRecord('sys_user_group');


gr1.addQuery('sys_id','IN',current.variables.groups.toString());


gr1.query();


while(gr1.next()){


if(gr1.description.indexOf(locationName)==0){


workflow.scratchpad.match = 'true';


}


}



Thanks,


Abhinay



PS: Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

21 REPLIES 21

Abhinay,



That worked. Thank you for working with me throughout this. It saves me from working the weekend! Everyone here is a gentlemen and a scholar!




Thanks,



Derek


Derek,



    Glad, you got this resolved.



Hit like, Helpful or Correct depending on the impact of the response



Thanks,


Abhinay