a!localVariable(
local!array: rule!integration2,
a!forEach(items: rule!integration2,
expression: 'type!{urn:com:appian:types:TEST}TEST_CDT'(
name: index(split(index(index(rule!integration1(input: fv!item)), 1), 2), "/), "name"),
email: index(split(index(index(rule!integration1(input: fv!item)), 1), 2), "/), "email")
)
I want to perform the calculations in one local variable and pass fv!items from each iteration in the expression to that local variable and then simple index the values and fill in the values in the CDT.
My idea is:
local!calculation: index(split(index(index(rule!integration1), 1), 2), "/), 1),
name: index(local!calculation(intVal: fv!item), "name"),
email: index(local!calculation(intVal: fv!item), "email"),
But intVal is a rule input for integartion1 object. What is the most efficient way to achieve this.
Discussion posts and replies are publicly visible
Maybe my blog post gets you started: appian.rocks/.../
Hi Stefan,Thank you for sharing the article, it was really helpful. The Article talked about reduce function.
In my scenario, we have an integration object "integration1" that have a rule input intVal, how can I modify reduce function according to this requirement.
I dislike the reduce() function personally (though it's sadly the only way to do some niche operations, outside of making recursive expression rules which is also ugly), but either way, i don't believe it applies to the use case you've described here if i'm reading your code correctly.
Please see my separate reply below in which I've refactored your existing code to (hopefully) accomplish the same functionality but much higher readability.
To be honest, I did not have a deeper look into your code as it is almost impossible to read, and also hard to understand what you want to achieve.
The best way to get great answers here, is to spend a bit of time on making it easy for us. I wrote blog posts and recorded podcast episodes on why this is important and how to do it.