Counting items in a list collector

kjones2
Kilo Contributor

I'd Like to create a catalog UI policy that disables catalog variables depending on the number of items in the collector. In my particular example i want to disable a multi line text variable if more than 1 selection is made in the list collector. It seems like it should be a simple thing to do but I'm struggling.

1 ACCEPTED SOLUTION
3 REPLIES 3

Great, thanks - that works in a catalog client script with a small modification.


Kalaiarasan Pus
Giga Sage

Might not be very efficient way to do but this should work



if(current.variables.groups.toString()=='')


  {


  gs.addInfoMessage('Array Length Is Zero');


  }


  else


  {


  var arrayLength=(current.variables.groups+',').split(',');


  gs.addInfoMessage('Array Length-'+parseInt(arrayLength.length-1));


  }



Note: If needed for client side, just modify accordingly