Is it possible to dynamically add values to an array? #306
-
Hi, suppose I have an input JSON like this:
I need to evaluate my rules and from these evaluations add results to the "results" array. I would mainly use "decision tables"... is there a way to dynamically add these values to the array in the outputs? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hi, this is indeed possible. You can use the loops to handle array of results. More information is available here: https://docs.gorules.io/docs/loops. |
Beta Was this translation helpful? Give feedback.
-
thanks! |
Beta Was this translation helpful? Give feedback.
-
@stefan-gorules
But, for example in my use case, I have an array of strings, it would be something like this:
(In my system they are not items, but I will put the example with items to continue with the example) My full input would be:
But, the result is not what I expected. I get this:
(Lo que quisiera es obtener en coupon el array con los mensajes de coupon). |
Beta Was this translation helpful? Give feedback.
Hi @diegolatorre16
You may achieve the above by using
Note the
$root
variableBut I would generally advise to map it to some object first.