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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Formatting trouble once again

Hi,

I have some trouble again with numeric variables.

I have to divide one variable through another (to get an average of costs).

The issue is, in the table where one of these variables comes from (using the PEEK() function) I have formatted that in the German format with '#.##0,00'.

<=> Internally I guess QlikView uses the '.' as decimal_separator. what I know is that dividing this through another variable (an integer) does not work.

=> I tried to replace the ',' with the '.' to make it usable, but I don't quite know how to do that in the script - it doesn't work yet. I guess QlikView misinterprets the ',' as a parameter_separator. On the GUI, it's no issue at all to divide the one through the other, but in the script ...

Can someone help me there?

Thanks a lot!

Best regards,

DataNibbler

P.S.: I'm just trying reformatting the field with the '.' as decimal_separator, that might work - but the variable is also used in another calculation and I have to see if that still works ...

33 Replies
swuehl
MVP
MVP

Henric,

In my request regarding issues with double quotes quoting, I was specifically adressing variable referencing:

  1. SET ThousandSep='.'
  2. SET DecimalSep=','
  3.  
  4. TEST: 
  5. LOAD num(F1) as F1, num(F2) as F2 INLINE [ 
  6. F1, F2 
  7. 10.75, 3.3359 
  8. ]; 
  9.  
  10. Let vA = Peek('F1',0,'TEST'); 
  11. Let vB = Peek('F2',0,'TEST'); 
  12.  
  13. Let vC = "vA" / "vB" +1; 
  14.  
  15. Let vD = "vC" /2; 

... as an alternative to $(# vVar).

Any known issues here?

Thanks,

Stefan

datanibbler
Champion
Champion
Author

Hmmm ... strange. Even with FIRST 10 it doesn't work - the LOAD is seemingly executed - it is complete in the log - and then it all stops.

From the table_viewer, I can see that in the original table from which I load RESIDENT, all the numbers are right-aligned all right. I will need to have a closer look tomorrow. I never encountered sth like this before ...

hic
Former Employee
Former Employee

It will work. Just two small corrections:

  1. You need to use quotes inside your inline table.
  2. You don't need the quotes to reference variables.

Hence:

TEST:
LOAD F1, F2 INLINE

[F1, F2
"10,75", "3,3359" ]
;

Let vA = Peek('F1',0,'TEST');
Let vB = Peek('F2',0,'TEST');
Let vC = vA / vB +1;
Let vD = vC /2; 

HIC

datanibbler
Champion
Champion
Author

Hi all,

I finally got it now - but I still have no idea why it didn't work yesterday. The problem with the calculation was fixed and then the rest of the RESIDENT LOAD failed - but it is only 248.000 records or so and about 30 fields. And even with a FIRST 10 it failed ... now I created a much slimmer aux_table for that info and join it later and that way it works fine.

Very strange ...