Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
Janneke
Creator
Creator

Values greater than variable1 and smaller than variable2

Hi all,

I have an application in QlikView with a table that contains values depending among others on two variables.

The expression is as follows:

=Sum({$<Amount={'>=$(=vFilterLow)<$(=vFilterHigh)'}>}Value)

To set vFilterLow and vFilterHigh I use an input box.

I can change the variables and the table reacts as expected. Only, when I put in rubbish like vFilterLow=1000 and vFilterHigh=0 I expect zero values in the table (since none of the amounts is greater than 1000 and smaller than 0). However, the table does contain rows.

What is happening here?

I hope you can help me. Thanks in advance.

Janneke.

1 Solution

Accepted Solutions
Peter_Cammaert
Partner
Partner

Yes, of course there is a fix for this. It's still pretty ridiculous to let users specify amount restrictions like

1000 < Amount < 50

so we should add a couple of constraints to the From: and To: values. Just like what is commonly done when using variables to specify calendar periods (e.g. From should come before Until and vice versa)

For each input variable, add a Custom constraint on the Constraints tab to force input values

  • for From to be smaller than or equal to To
  • for To to be larger than or equal to From

Also add default values for each variable, optionally based on the minimum and maximum values of the field you try to filter (like =Min({1}Amount) and =Max({1}Amount) )

Best,

Peter

View solution in original post

9 Replies
vishsaggi
Champion III
Champion III

Is your expression working with different set of values entered? If yes, then can you share your sample to look into please?

Janneke
Creator
Creator
Author

Hi,

This is an example of my problem.

I hope this makes it easier to understand the issue.

Thank you all for helping.

Janneke.

Peter_Cammaert
Partner
Partner

Hmmm, I get this:

GT Var1 LT Var2 thread273503.jpg

This is not what you expect?

vishsaggi
Champion III
Champion III

IS this not what you are getting?

Capture.PNG

Janneke
Creator
Creator
Author

Hi Vishwarath,

If you 'play' with the input variables, you'll see that sometimes it shows the right table, but also it can show values.

For instance, if I immediately put in 1000 and 0 I get your screenshot. If I then change the 0 to 200 I get this:

Untitled.png

And this is also an outcome:

Untitled2.png

It doesn't always show what I expect....

Janneke
Creator
Creator
Author

Hi Peter,

Please check the answer I gave to Vishwarath.

Yes, your screenshot is what I expect with these values. In the provided sample I simplified my application, I guess that's why the outcome is different than my original application .

If you 'play' with the variables you see unexpected outcomes (at least unexpected for me), such as shown in my reply to Vishwarath.

Do you have any suggestions on how to fix this?

Janneke.

Peter_Cammaert
Partner
Partner

Yes, of course there is a fix for this. It's still pretty ridiculous to let users specify amount restrictions like

1000 < Amount < 50

so we should add a couple of constraints to the From: and To: values. Just like what is commonly done when using variables to specify calendar periods (e.g. From should come before Until and vice versa)

For each input variable, add a Custom constraint on the Constraints tab to force input values

  • for From to be smaller than or equal to To
  • for To to be larger than or equal to From

Also add default values for each variable, optionally based on the minimum and maximum values of the field you try to filter (like =Min({1}Amount) and =Max({1}Amount) )

Best,

Peter

Janneke
Creator
Creator
Author

Thank you Peter,

I have put in $<=vFilterHigh and $>=vFilterLow and everything works great.

Thanks for the help!

Greetings, Janneke.

KishoreSuri
Creator
Creator

Please share the expression and details how to got the values of Min and Max and How to be enter between this range.

Thanks,
Kishore S