Suppose that a source contains a column which holds the salary information prefixed with the currency code, for example
EMPNO
ENAME JOB
MGR HIREDATE
SAL
DEPTNO
7369 SMITH
CLERK 7902
17-DEC-80
$300
20
7499 ALLEN
SALESMAN
7698 20-FEB-81
£1600
30
7521
WARD
SALESMAN
7698 22-FEB-81
¥8500
30
|
In the target different currency will evaluate to a
single currency value, for example covert all to Rupees.
- First thing we should consider that there are
different types of currency like pound, dollar, yen etc. So it’s a good
idea to use mapping parameter or variable. Go to mapping => mapping parameter
and variables then create three parameters (for this example) and set its
initial value as bellow
Then
drag the source to mapping area and connect to an expression transformation.
In
expression create a output port as sal1 and make sal as input only as bellow.
in sal1 port write the condition as below
IIF(INSTR(SAL,'$')!=0,TO_INTEGER(SUBSTR(SAL,INSTR(SAL,'$')+1,LENGTH(SAL)-1))*$$DOLAR,
IIF(INSTR(SAL,'£')!=0,TO_INTEGER(SUBSTR(SAL,INSTR(SAL,'£')+1,LENGTH(SAL)-1))*$$POUND,
IIF(INSTR(SAL,'¥')!=0,TO_INTEGER(SUBSTR(SAL,INSTR(SAL,'¥')+1,LENGTH(SAL)-1))*$$YEN
)
)
· $DOLAR, $$POUND, $$YEN
these are mapping parameter. you can multiply price in rupee directly for
example dollar price in rupees i.e 48.
If pound , dollar and yen are having different currency Rate to convert into Indian Rupee , it means $1=48 and other two are 30,60 . Then how we initial values for this Three different currency with three different values
ReplyDeletei getting for the values for dollars only
ReplyDeleteHi Manohar,
ReplyDeletefirst look on to the mapping Parameters, the image shows value for that particular port(Dollor$).I have specify the intial value as 48.
--->Next click on $$YEN parameter and set the initial value=30
--->Next click on $$POUND parameter and set the initial value=60
try this...
thanks
kareem
Hi Kareem,
ReplyDeleteI tried doing the said expression and I am getting error message 'Syntax Error'
iif(instr(SAL,'$')!=0,TO_integer(SUBSTR(SAL,INSTR(SAL,'$')+1,LENGTH(SAL)-1))*$$DOLLAR,
iif(instr(SAL,'£')!=0,TO_integer(SUBSTR(SAL,INSTR(SAL,'£')+1,LENGTH(SAL)-1))*$$POUND,
iif(instr(SAL,'¥')!=0,TO_integer(SUBSTR(SAL,INSTR(SAL,'¥')+1,LENGTH(SAL)-1))*$$YEN
)
)
<<<<
I had already set the amount in Mapping>Parameters and Variable.
And how do I show the return value as in Indian Rupees.
Kindly help me in solving this issues.
Thanks,
Robin
It will be good if we implement the above problem using lookup table.This way we add more currency on the go and update the currency rates without changing the code
ReplyDeleteExcellent information on your blog, thank you for taking the time to share with us. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. convert money calculator
ReplyDeleteI have done the same but the .out file is showing empty
ReplyDeleteCan you help....??