Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rido1421
Creator III
Creator III

Creating a custom list box

Hi There

I have a list box that I need to limit what selections are available.

I need to force the listbox to look at a one of the Descriptions= "Expenses"

I cant use an if statement in this case , if there is no selection then the listbox will display everything

Im assuming I should use the getselections function in some way...

Basically what I am trying to do is if(Description='Expenses',Cost_Centre) - this would only work if Expenses is selected.

How do I force it to look at Expenses and Display the Cost Centre?

Thank you

10 Replies
tresesco
MVP
MVP

Like this?

if(GetFieldSelection(Description)='Expenses',Cost_Centre)

rido1421
Creator III
Creator III
Author

Hi Treseco

I see that also only works if you select the field expenses... how can I get it to display only the cost centers for expenses by default...

Not applicable

Why don't you create a Hierarchic group and place that group in the list box?.It seems like if you click Expenses on the list box you want to show all the child of expenses ?

tresesco
MVP
MVP

Ideally,  'if(Description='Expenses',Cost_Centre)'  should work in listbox. Can you post a sample qvw?

jagan
Luminary Alumni
Luminary Alumni

Hi,

I think it is better to bring a new field in script, then it would be easier in front end

LOAD

*,

If(Descriptions= 'Expenses', CostCenter) AS NewField

FROM DataSource;


Now use NewField as a dimension in Listbox.  Using expressions in listboxes is not a good practice.


Regards,

Jagan.

rido1421
Creator III
Creator III
Author

The normal if statement does work but it seems to be giving me blanks in the list box which doesnt make sense

Description is a field from the UDR ... do you think this could be messing my model up a bit?

rido1421
Creator III
Creator III
Author

Thanks Jagan

But i think based on the Set up of my model I have know choice but to use the expression...

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

List box -> Field -> Select Expression and give-> =If(WildMatch(Description, 'Description'), Cost_Centre)

If this is not working then attach sample file.

Regards,

Jagan.

jagan
Luminary Alumni
Luminary Alumni

Hi,

If you got the answer please close this thread by giving Correct Answer to the useful post.

Regards,

jagan.