Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Inputfield as Num() in Script Load

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

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

8 Replies
micheledenardi
Specialist II
Specialist II

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 [...]

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
micheledenardi
Specialist II
Specialist II

Additional information about Qlik Data types here:

Data Types in QlikView

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

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‌?

sunny_talwar

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

Anonymous
Not applicable
Author

Many thanks Sunny. Hoping he will see this in time

marcus_sommer

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

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

http://masterssummit.com

http://qlikviewcookbook.com

Anonymous
Not applicable
Author

Alright, Thank you Rob.