Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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?

Tags (2)
1 Solution

Accepted Solutions
alexpanjhc
Valued Contributor

Re: Show customers based on a button

the attached should work as you asked.

16 Replies
Not applicable

Re: Show customers based on a button

hi

define variable for your range of name then take

button-->

action-->

setvariable-->

variablename= var

Not applicable

Re: Show customers based on a button

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

sbobbyraj
Contributor III

Re: Show customers based on a button

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

Re: Show customers based on a button

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!

sbobbyraj
Contributor III

Re: Show customers based on a button

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

Re: Show customers based on a button

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

Re: Show customers based on a button

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
Valued Contributor

Re: Show customers based on a button

the attached should work as you asked.

kuba_michalik
Contributor III

Re: Show customers based on a button

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.

Community Browser