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: 
Not applicable

Show customers based on a button

Hello

If i have a listbox with customers from A to Z - But i have sooooo many i wanna split them up.

I wanna split them up by a button

My button should be named A to F and when i press that button, i should only be able to see customers from A to F in a listbox...

How do i do that???

I created a listbox called Customers

And a button called A to F

In my button i created an action called select in field (field: Customers, Search string: if(DimCustomers < 'G', DimCustomers, '')

But that does not seem to work?

1 Solution

Accepted Solutions
alexpanjhc
Specialist
Specialist

the attached should work as you asked.

View solution in original post

16 Replies
Not applicable
Author

hi

define variable for your range of name then take

button-->

action-->

setvariable-->

variablename= var

Not applicable
Author

That does not work??

what should value be? And i guess my variable should not be vCustomers = if(DimCustomers < 'G', DimCustomers, '')

buy something else

vCustomers = DimCustomers>='G' ??

Anonymous
Not applicable
Author

Hi,

You can use function

ORD(custumer)

which returns an integer that is the ASCII number of the first letter of your filed "custumer"

If you want to cut with "F", then the ASCII number is 70. You can use a button with condition on ASCII number.

In your script you can add the table:

CustumerLetter:

LOAD

     custumer,

     if(ORD(custumer)<=70,'A to F','G to Z') as CustumerLetter

RESIDENT

     YourTableName;

Then your don't even need button, your selection list on CustumerLetter is enough

If you want more help, join your qvw

Not applicable
Author

Ive just attached my document. Can you have a look=? I dont wont to cut anything away in my model.

I just want Buttons to be like A to F and G to L for instance

Which when you hit one of the buttons, you are only able to see A to F Customers in a listbox..

Thanks in advanced!

Anonymous
Not applicable
Author

Your document was not joined to your message.

But you can use this method:

CustumerLetter:

LOAD

     custumer,

     if(ORD(custumer)<=70,'A to F',if(ORD(custumer)<=76,'G to L','M to Z')) as CustumerLetter

RESIDENT

     YourTableName;

Then your don't even need button, your selection list on CustumerLetter is enough

If you want more help, join your qvw

Not applicable
Author

YEs it is in the top, to the subject.

How do you know which ord number the specific letters got?

But, i want a button !! I dont want to cut it out by scripting.. I can easily do that by other methods.

Not applicable
Author

How come it does not work with a simple variable?

if i got variable vCustomerAtoF = if(DimCustomers < 'F', DimCustomer,'')

If i type the expression in my listbox then i will get all customers up to F

However, do i insert it as a variable, nothing happens? But its the same basically?

alexpanjhc
Specialist
Specialist

the attached should work as you asked.

kuba_michalik
Partner - Specialist
Partner - Specialist

Too many equal signs.

Your variable is: =if(DimCustomers < 'F', DimCustomer,'')

If you put $(vCustomerAtoF) as expression in ListBox, QlikView will always stick '=' in front of it automatically, and the formula will expand to ==if(DimCustomers < 'F', DimCustomer,'') wihich is invalid. Remove equal sign from variable contents and it should work. Also, I suggest using Null() instead of '', or you will get a clickable blank value associated to all clients over F in your listbox.