Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
I would replace the left(@5,len(@5)-1) syntax by NUM#(left(@5,len(@5)-1)) because you could have some strnage behavior ...
so it means thatt i have to stop using right(...,1) ?
Hi,
you can use right, but to be sure to clean the string use trim() function
BR, Annette
Thank you for the proposal, i tried but with no success 😞
if(right(trim(@5),1) = '-' , 0-left(@5,len(@5)-1), @5 )
Best regards
Philippe
Hi,
is it possible to post the application?
BR, Annette
here it is
QV interprets the value in @5 as a number though your setting is a leading '-'.
That's why the right function does not work here. the number is -1420.76 in QV and has no '-' following.
Regards, Annette
the first line is not the problem, look at the second one, the figure is positive nevertheless Qlikview show it as a negative one
regards
Yes, I understand.
The problem is that QV interprets @5 as a number. Even if you try to force QV to take it as a string with text()
Obviously there is a difference between left and right.