Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

strange behaviour with right function in load script

hello,

i have an issue in scripting using right function on my values always return negative sign -

My code is

[Code]LOAD @1 as %Key1,

@2 as %Key2,

@3 & '_' & @4 as %Key3,

@3 as %Key4,

@4 as %Key5,

if(index(@5,'-') <> 0 , 0-left(@5,len(@5)-1), @5 ) as [Value In Local Currency not bugged],

if(right(@6,1) = '-' , 0-left(@5,len(@5)-1), @5 ) as [Value In Group Currency bugged ]

FROM .\OHUB_YDCVARHIS_test.CSV (ansi, txt, delimiter is ';', no labels, msq);[/Code]

when i process my file :

9320;01000100;A2;00;716670.00;716670.00;716670.00;716670.00;EUR;EUR;2009003;K4

the result is always negative when i'm using the second formula 😞

Did i do something wrong ? or is this a known bug ?

thx for your replies

Labels (1)
10 Replies
vidyut
Partner - Creator II
Partner - Creator II

if(index(text(@5),'-') <> 0 , 0-left(text(@5),len(text(@5))-1), text(@5) ) as [Value In Local Currency not bugged],
if(right(trim(text(@5)),1) = '-' , 0-left(text(@5),len(text(@5))-1), text(@5) ) as [Value In Group Currency bugged ]

This works if you put Text(@5) instead of just @5