Hi, i have table with 3 columns : exchange-rate is double , currency is a string , price is double
I added a generated column to multiply price column by exchange-rate column
But the problem is i have more than one currency,
i want to add code to that generated column so that if currency column value is “SAR” for example price / SAR
ElSE if currency is EGP price / EGP
i know that i should use sql but my question is
how to get the value of the currency coulmn and write it to the expression
like if currency = ‘sar’
THEN Do this
ELSE IF currency = ‘egp’
Do this
Endif
Thanks in advance
i have found a solution, thanks
CASE
WHEN currency IN (“egp”)
THEN price / egpToUsd
WHEN currency IN (“aed”)
THEN price / AedToUsd
END