โ11-06-2019 01:45 PM
Hello All,
Is there a way to select the account reference dynamically based on the criteria?
For example, If I pass โGoods ODBCโ as a parameter can snaplogic automatically select the specified account reference?
Solved! Go to Solution.
โ11-06-2019 02:39 PM
Hi skodali,
If you enable the equal toggle sign you can write JavaScript expressions. Please see screenshot bellow:
I believe in your case, you can specify pipeline parameter (ex. account_reference) in which you can pass the values (ex: โGoods ODBCโ). The expression would be:
_account_reference == โGoods ODBCโ ? โโฆshared/Goods ODBCโ : โother accountโ.
If the expression evaluates true it will dynamically select the โโฆshared/Goods ODBCโ account.
Please let me know if this helped you or if you need additional information.
Regards, Jovan.
โ11-06-2019 02:39 PM
Hi skodali,
If you enable the equal toggle sign you can write JavaScript expressions. Please see screenshot bellow:
I believe in your case, you can specify pipeline parameter (ex. account_reference) in which you can pass the values (ex: โGoods ODBCโ). The expression would be:
_account_reference == โGoods ODBCโ ? โโฆshared/Goods ODBCโ : โother accountโ.
If the expression evaluates true it will dynamically select the โโฆshared/Goods ODBCโ account.
Please let me know if this helped you or if you need additional information.
Regards, Jovan.
โ11-07-2019 07:44 AM
Hello Jovan,
Thanks for the prompt response.
If I enabled the equal toggle sign I can only see the pipeline parameters and not the input schema from the mapper. Is there any way to get the Input Schema values into the Account Reference?
It works when I use the pipeline parameters for the condition like
_a == 1 ? โshared/INTโ: โOtherโ
How can I write the condition in the account reference if I have more than One if condition?
if (_a == 1) {
return โshared/INTโ;
} else if (_a == 2) {
return โshared/Goodsโ;
} else if (_a == 3)
return โshared/NAMโ;
} return โOtherAcctโ
โ11-07-2019 08:21 AM
Hi skodali,
In the account reference you can use pipeline parameters. Please check the link for more details.
To write multiple conditions you can use the ternary operator.
The expression which you have specified can be replaced with ternary operator as following:
_a ==1 ? โshared/INTโ ?(_a ==2 ? โshared/Goodsโ ? (_a ==3 ? โshared/NAMโ : โOtherAcctโ): โOtherAcctโ) : โOtherAcctโ
Or additionally you can use the match control operator, with this operator you can get:
match _a {
1 => โshared/INTโ,
2 => โshared/Goodsโ,
3 => โshared/NAMโ,
_ => โOtherAcctโ
}
Regards, Jovan.
โ11-07-2019 11:09 AM
Thanks Jovan, this helps a lot.