Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have an inputfield in the load script that needs to be declared as numeric using the Num() function. This is according to the Document Analyser.QVW.
My script looks like this:
Inputfied myField;
Load
Num(0) as myField
From [...]
Basically, I'm filling the column with zero to be able to fill it later on. However, it is not in the optimal 8 bytes storage.
Any thoughts?
Bryan
InputFields have some special characteristics as Marcus said. I would not be concerned about the Document Analyzer recommendation in this case. I'll see if I can update DA to not make this recommendation for InputFields.
-Rob
According to Data types in Qlik Sense Qlik field are not formatted as strings, dates or numbers but it depends which is the content of these field... You can format the content as text or number, not the field !
so
Inputfied myField;
Load
0 as myField, //myField is automatically recognised as numeric
text(0) as myFieldText, // myFieldText contains 0 formatted as text
num(0,'#.##0,00') as myFieldWithDecimals, //myFieldWithDecimals contain 0.00 (with 2 decimals)
if(IsText(myFieldTest),myFieldTest, num(myFieldTest,'#.##0,00') //here the content could be text or number with 2 decimals... depending if the content is numeric or not..
From [...]
Additional information about Qlik Data types here:
Declaring "0 as myfield" does indeed make it numeric automatically i'm aware but it is taking more bytes to store. The num() function reduces that. This is the recommendation from the document analyser: "the numeric field is occupying more than the optimal 8 bytes. Correct this problem by explicitly using the num() function."
My question still remains, does anyone know the syntax to explicitly declare an inputfield as numeric?
stalwar1?
I am not sure I know this, but since you mentioned document analyzer, may be rwunderlich might be able to give his suggestions as he is the master mind behind document analyzer
Best,
Sunny
Many thanks Sunny. Hoping he will see this in time
I think it's optimal loaded even if you see that it needs 9 bytes (it's from the mem-file) because of the fact that it's not a normal field else an inputfield which information needs to be stored too - and all records will be handled as an unique value. This means (my load was an autogenerate 10000) that the symbol table contains 10000 values. I could imagine that this is what the document analyzer had detected ...
- Marcus
InputFields have some special characteristics as Marcus said. I would not be concerned about the Document Analyzer recommendation in this case. I'll see if I can update DA to not make this recommendation for InputFields.
-Rob
Alright, Thank you Rob.