Hi! I need to get a subset of elements from an array. I'm using rdrop f

Hi!
I need to get a subset of elements from an array. I'm using rdrop function that return the subset. The elements returned are separated by comma and not by semicolon. So, when I pass this subset to a doforeach function the process generates this error: There is a problem with task “Script Task” in the process. The expression function 'doforeach("rule",{2484.0,2440.93,2352.93})' (user=SuperUser, exprId=536870915) could not be evaluated: java.lang.ArrayStoreException (Data Outputs)

Thanks...

OriginalPostID-37423

OriginalPostID-37423

  Discussion posts and replies are publicly visible

  • What is the definition of your rule named "rule?" I would like to try to replicate this on my own build. How are you determining that the values are being stored with a comma and not semicolon? The error thrown shows it is a comma, but that is actually the correct display based on the logging of the function I have previously seen.
  • The data type is not affected by the delminter. For e.g. When you define an array in a constant, you separate them with a semi-colon but in the process variable, you see them comma separated. As long as you are not converting the array to a string (for e.g. using joinarray etc) the doforeach should work.
  • For Michael: the rule is "=if(ri!param1>2000,ri!param1,0)" and the parameter is generated by another rule that generates the subset "=rdrop(ri!param1,(length(ri!param1)-((length(ri!param1)/100)*ri!param2)))" where param1 is a Number(Decimal) array and param2 is an integer that determinates the percentage of values to be considered. Starting process for debugging or testing the rule I see the output datasubset is something like this {decimal1,decimal2,decimal3} . But, reading Santhya's considerations...how can I determine if the values are really separated by comma or semicolums?
  • Marco, I am not sure if there is any need to find out what the Tokenizer is. As long as the rules accept a multi value PV! and if you are passing a multi value pv! as input, it should work. What I was trying to say was to identify if the value you are passing is an array or string. For e.g. If I store {"a;b;c;"} into an array, then only the first element of the array is populated as the entire string (even though it looks like its an array of 3 elements. The easy way I'd test this is to pass your pv! array to JOINARRAY function and join by a delimiter to find out how the data tokenizers.