cancel
Showing results for 
Search instead for 
Did you mean: 

Logic Script BPC10: Currency Conversion Using Lookup function returns 0.

Former Member
0 Kudos

Hello Experts,

   I am trying to do currency conversion. I have PARAMETRE model that holds the monthly exchange rates. Than i wrote a script logic that reads the values and convert USD,GBP,TRY to EUR. I am sharing my script below.

*XDIM_MEMBERSET SENARYO = %SENARYO%

*XDIM_MEMBERSET YATIRIMKLM = Y9000

*WHEN YATIRIMKLM

*IS Y9000

*REC(FACTOR=0)

*ENDWHEN

*COMMIT

*XDIM_MEMBERSET SENARYO = %SENARYO%

*XDIM_MEMBERSET PARABIRIMI = TRY,USD,EUR,GBP

*XDIM_MEMBERSET YATIRIMKLM = Y01001

*LOOKUP PARAMETRE

*DIM PARAMETREKLM = "P1000"

*DIM TRY:PARABIRIMI="TRY"

*DIM USD:PARABIRIMI="USD"

*DIM EUR:PARABIRIMI="EUR"

*DIM GBP:PARABIRIMI="GBP"

*DIM SIRKET = "NA_SRK"

*ENDLOOKUP

*WHEN PARABIRIMI

*IS EUR

*REC(FACTOR=1,YATIRIMKLM=Y9000,PARABIRIMI=EUR)

*IS USD

*REC(EXPRESSION=%VALUE%*(LOOKUP(USD)/LOOKUP(EUR)),YATIRIMKLM=Y9000,PARABIRIMI=EUR)

*IS TRY

*REC(EXPRESSION=%VALUE%*LOOKUP(EUR),YATIRIMKLM=Y9000,PARABIRIMI=EUR)

*IS GBP

*REC(EXPRESSION=%VALUE%*(LOOKUP(GBP)/LOOKUP(EUR)),YATIRIMKLM=Y9000,PARABIRIMI=EUR)

*ENDWHEN

*COMMIT

I try many different things. I control my context and xdim values for correct select and i see that i can read 48 excahnge rate values from model but while calculation it all calculated as 0. Only EUR value stay same. I also share my log file.

CALCULATION BEGIN:

QUERY PROCESSING DATA

QUERY TIME : 0.00 ms. 1  RECORDS QUERIED OUT.

QUERY REFERENCE DATA

QUERY LOOKUP DATA FROM APPLICATION: PARAMETRE

QUERY TIME : 0.00 ms. 48  RECORDS QUERIED OUT.

CALCULATION TIME IN TOTAL :0.00 ms.

1  RECORDS ARE GENERATED.

CALCULATION END.

ENDWHEN ACCUMULATION: 5  RECORDS ARE GENERATED.

DATA TO WRITE BACK:

BOLUM    DONEM    MASRAFYERI    PARABIRIMI    SENARYO    SIRKET    VERSIYON    YATIRIMKLM    YATIRIMKODU    SIGNEDDATA

IT    NA_DNM    1020_0000100100    EUR    BP_2015_V1    AFM    VE01    Y9000    YK_IT_2015_0002    200000.00

IT    NA_DNM    1020_0000100313    EUR    BP_2015_V1    AFM    VE01    Y9000    YK_IT_2015_0002    200000.00

IT    NA_DNM    1020_0000100100    EUR    BP_2015_V1    AFM    VE01    Y9000    YK_IT_2015_0001    0.00

IT    NA_DNM    1020_0000100313    EUR    BP_2015_V1    AFM    VE01    Y9000    YK_IT_2015_0001    0.00

IT    NA_DNM    1020_0000100313    EUR    BP_2015_V1    AFM    VE01    Y9000    YK_IT_2015_0003    0.00

5  RECORDS HAVE BEEN WRITTEN BACK.

WRITING TIME :1.00  ms.

I need a quick help for this. Thanks for your helps.

Can

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member186338
Active Contributor
0 Kudos

Sorry,

Please explain, why you are testing some long and complex script instead of something simple?

For a single currency with the value existing in the rate model etc...

Vadim

P.S. Also please close another open discussions!

Former Member
0 Kudos

Hi Can,

Is your PARAMETRE model a Rate type Model? How have you maintained rates? please give an example.

For more help on currency conversion using the LookUp function refer below links:

Regards,

JP