Welcome Guest! Log in

Topic-icon Question How to split the values of an input parameter with scripting ?

  • Nicolas Verscheure
  • Nicolas Verscheure's Avatar Topic Author
  • Offline
More
16 Dec 2014 18:07 - 17 Dec 2014 09:32 #1 by Nicolas Verscheure
Nicolas Verscheure created the topic: How to split the values of an input parameter with scripting ?
It's possible to call a delivery with a parameter like that : 'ABC', 'DEF', 'GHI'
Unfortunately, it's not always possible to use the singles quotes especially when you are using a professional scheduler like Visual Tom. Indeed the singles quotes are interpreted by the scheduler.
You can solve it simply using this scripting :

%e(rhino){
var str = "${~/inListOfValues}$";
var n = str.split(",");
var result = "";
for(var i = 0;i < n.length;i++) {
    if(result != "") result += ",";
    result += "'"+n[i]+"'";
}
println("inListOfValues = ${~/inListOfValues}$");
println("inListOfValues splitted = " + result);
}e(rhino)%


Result :






Thus you can use the splitted values in a filter in a mapping for example.
Attachments:
Last Edit: 17 Dec 2014 09:32 by Nicolas Verscheure.

Please Log in or Create an account to join the conversation.