Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Can someone explain this?
LOAD * INLINE
[Name, Value
Name1, "0000"
Name2, "00000000000000"
];
Results in:
And
LOAD * INLINE
[Name, Value
Name1, "0000"
Name2, "0000000000000000"
];
Results in:
Is there a reason for this behavior?
That's not what I've suggested (using text() function in your load). Why are you using variables here?
But anyway, here your go:
let Value = Text('0000');
TEST:
LOAD Key, Name, text(Value) as Value INLINE
[Key, Name,Value
1, Name1, $(Value)
];
let Value = Text('000000000 ');
LOAD Key, Name, text(Value) as Value INLINE
[Key,Name, Value
2,Name1, $(Value)
];
Numbers in qlikview can have only 14 digits. Any string with more digits will be considered text. So in your first example both strings will be evaluated as numbers. But in the second example the second string cannot be interpreted as a number so it ends up as a text value.
Use the Num function to keep trailing zeros.
Num(Field , '##########0')
Thans for your reply, Gysbert,
If qv interprets the string as a number, why doesn't it display a '0' instead of '0000' in the first example?
I need the input to be strings, so I tried:
let Value = Text('0000');
TEST:
LOAD * INLINE
[Key, Name,Value
1, Name1, $(Value)
];
let Value = Text('000000000 ');
LOAD * INLINE
[Key,Name, Value
2,Name1, $(Value)
];
Same result however:
Thanks for your reply dathu.qv,
Could you give an example? I wasn't able to load the values in the first example using this function.
Because QV also tries to keep the format as seen for the first occurrence. Add another line Name0, 0 as first line to the first inline loaf of your initial post to see what I mean. Use the num() function to explicitely define the text representation of your value (and if you don't already know, search for dual value to read more about this).
Thank you swuehl,
Ok, I understand what you mean.
In my case, the values I want to load are strings. So '0000' and '000000' aren't the same and aren't numbers.
(codes for categories in my case, as '0' or '00' could be). The dual function would be helpful, but then I would have to define all categories in advance, and I don't know how many and which to expect.
I'm looking for a way to force qv to load the values as strings.
Use the text() function
LOAD Name, text(Value) as Value INLINE
[Name, Value
Name1, "0000"
Name2, "00000000000000"
];
That's not what I've suggested (using text() function in your load). Why are you using variables here?
But anyway, here your go:
let Value = Text('0000');
TEST:
LOAD Key, Name, text(Value) as Value INLINE
[Key, Name,Value
1, Name1, $(Value)
];
let Value = Text('000000000 ');
LOAD Key, Name, text(Value) as Value INLINE
[Key,Name, Value
2,Name1, $(Value)
];