Welcome Guest! Log in
×

Notice

The forum is in read only mode.
Due to some maintenance operations, stambia.org will be switched to read-only mode during the 13th November. It will be possible to read and download, but impossible to post on the forums or create new accounts. For any question please contact the support team.

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.