Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dealing with null value in variable (inputbox)

Hi guys

I just think that variable management isn't developed good enough in Qlikview or I just can't get it right (maybe the second affirmation is more probable) .

I get one variable defined in an input box and want to do some calculations with it and null case is a big deal for me, I attached a qvw file to illustrate the situation at a basic level but the expressions I'm using are:

- Left text box: =If($(=len(vVariable))=0, 'Empty', $(vVariable)) => Works good, shows variable value without a problem and 'Empty' when null

- Right text box: =If($(=len(vVariable))=0, 'Empty', 'Value: '&$(vVariable)) => Works good with value, when null I get Expression Error (as you first see)

This is pretty basic but if you replace the else case by another if condition using the vVariable get the same issue.

Do you know how can I correctly handle null value on this case?

Thanks

13 Replies
Not applicable
Author

Thanks Rakesh, I still want to know when to expand and when not using expressions in another variables, do you know the common scenarios?

Not applicable
Author

did not understand you question?

could you please describe?

Not applicable
Author

I mean, when do I have to expand the variable and when no? My expression =If($(=len(vVariable))=0, 'Empty', vVariable) was for another variable in this case. I identify this cases:

1. Using functions: call the function in the expansion of the variable

- len($vVariable) => doesn't work

- len(vVariable) => probably work, haven't tried

- $(=len(vVariable) => Works

2. Conditionals: not expand the variable

- If(condition, $(vVariable), 0) => doesn't work (although it wasn't error)

- If(condition, vVariable, 0) => Works

I wan to better determine these cases or the cases that actually apply

Not applicable
Author

ok,

when you'll apply a condition you just need to write variable name no need to apply '$' sign.