cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Account Reference

skodali
New Contributor III

Hello All,

Is there a way to select the account reference dynamically based on the criteria?
image

For example, If I pass โ€œGoods ODBCโ€ as a parameter can snaplogic automatically select the specified account reference?

1 ACCEPTED SOLUTION

jovan_j
New Contributor III

Hi skodali,

If you enable the equal toggle sign you can write JavaScript expressions. Please see screenshot bellow:
image
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.

View solution in original post

4 REPLIES 4

jovan_j
New Contributor III

Hi skodali,

If you enable the equal toggle sign you can write JavaScript expressions. Please see screenshot bellow:
image
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.

skodali
New Contributor III

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โ€

jovan_j
New Contributor III

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.

skodali
New Contributor III

Thanks Jovan, this helps a lot.