Hello, Everybody !
Could you help me, please, to understand what’s wrong with my FEEL context merge() function - “Union the given contexts. Returns a new context that includes all entries of the given contexts”.
I have two variables with JSON and I want to merge they together - just add property {“mainExec”:“1”} to “group01” in List.
Maybe it’s possible to add param {“mainExec”:“1”} to “group01” in the List by using context put(context, key, value), but I have problems with this one too
Since both var1 and var2 have a path of /executors the executors from var2 is overwriting var1.
But I agree with you, that’s not how I would have understood it.
I would have expected the array of /executors/execGroups to be extended, and the key /executors/execGroups/execGroup{group1} to be overwritten.
Playing with it over on the Playground, even if /executors is changed to an array of values, it’s still overwritten, since the key (/executors) is still the same.
Thanks for your answers, Gentlemens !
So, is it possible to add item {“mainExec”:“1”} to {"execGroup":"group01"} in var01 variable and get a new one in the List like: {"execGroup":"group01","mainExec":"1"}
If yes, then how to create var02 or maybe use another function ?
Thanks, hassang for your solution !
I changed the names of var1 & var2 to var01 & var02 and it works.
But is it possible to make a solution for dynamic List when I don’t know index of item I want to modify ? Just by name.
Or, maybe, it’s possible to calculate the number of index by name ?
Anyway, thank you for this knowledge. I saw some undocumented possibilities for working with context, I can use in the future.