Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is there a way to change a value in a list box?,For example, I have a list box where the value is apple but I want it to read Granny Apple and when you filter on Granny Apple results from Apple should appear in your table box, is that possibe?
If not, I can make these edits in the script but I will need help
List Box
Apple
Banana
Orange
Results:
List Box
Granny Apple
Banana
Orange
//Script syntax:
Apple:
SQL
xxxxxxxxxxxxxx
Distinct:
SQL
xxxxxxxxxxxxxx
Final Table:
inner join (Apple)
Load
Columns from Distinct
Resident [Distinct]
Drop table [Distinct]
Where would I make edits to the Apple table , would I have to create a separate load statement for Apple?
Alternatively you can create the expression in the listbox itself. If(Field like 'Apple', 'Granny Apple', Field)
maybe adding a field (NewField)
source:
load * inline [
Field, Value
Apple, 1
Banana, 2
Orange, 3
];
left join (source)
load *,
if(Field='Apple', 'Granny Apple', Field) as NewField
Resident source;
Alternatively you can create the expression in the listbox itself. If(Field like 'Apple', 'Granny Apple', Field)
Exactly what I was looking for, thanks.
hi.
try this
if(Field='Apple', 'Granny Apple', Field) as NewField
How many IF statements can one have in the list box expression?
The reason I ask, I have a table below: 45 different columns that need to be added into a list box
ID Apply Banana Orange XXX xxx xxxx xxx xxx
1 x x x x
2 x x x
3
4
5 x x x
6...Thds of records
It sounds like you really do need to modify your script to include a lookup type table. Effectively you need a dimension table to get the names.
So let us say that your data load script leaves you with a table like this:
ID | Fruit | Price | Qty |
---|---|---|---|
1 | Bananna | 10 | 2 |
2 | Apple | 15 | 3 |
3 | Pear | 18 | 5 |
Use inline script to add another table like this:
Fruit | FruitLongName |
---|---|
Bananna | Big Yellow Bannanna |
Apple | Granny Smith Apple |
Pear | Nice Pear |
The common field name 'Fruit' will join the tables. Then in your list just use FruitLongName.
The load script for the dimension table would look like this:
Load * Inline [
Fruit, FruitLongName
Bannanna,Big Yellow Bannanna
Apple,Granny Smith Apple
Pear, Nice Pear
]
From what you have said it seems like you need to present this in a straight table rather than a list box.
remember that in Qlikview, you can select on the field in the table, it doesn't have to be a listbox.