Table of Contents
Use Case
In most cases, you need to do some transformations or mapping if a property meets certain conditions. In order to achieve that, Alumio has Conditional Transformer, which allows you to compare the value of a property with a static value defined in the transformer.
Now, what if you need to compare dynamic values between two properties as a condition before doing some transformations or mapping? Alumio has a limitation where it doesn’t support parsing placeholders yet in the compared value.
As you can see above that Alumio will not compare values between property foo
and bar
as placeholders are not supported yet in the Value field.
What we can do is to define a new variable whose value is a result of comparison between the values of foo
and bar
using JMESPath. Then, we use the new variable in Conditional transformer and compare it with boolean True
or False
.
Steps to Follow
Let’s say you have the below entity data.
{
"foo": true,
"bar": true,
"result": null
}
You need to set a value of result
to "passed"
if the value of foo
equals to the value of bar
.
First, you need to define a new variable namely, i.e., check
and the value should be a boolean value as a result of comparing the value of foo
and the value of bar
(check if they are equal). You can use a Value setter with the help of JMESPath to do so.
Once you have the check
property with the boolean value, you can freely do any comparison with it using Conditional Transformer and decide what to do afterward.
If you have the values of foo
and bar
are equal, then the result
property will have a value of “passed” as defined in the Value Setter inside the Conditional Transformer.
Even further, you can do more complex comparison and use the value of the final “check” property to use as a condition in a Conditional Transformer.