Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Is there a simple way to restict the contents of a list box?
For example records with a field "Action" which has the values "Open", "Waiting", "Connect" and "Closed".
I just want to show a list box with the values "Waiting" and "Connect"? So restrict it to just these values only?
Thanks
Joe
There are two ways (At least)
1. Use Calculated dimension or Expression in the listBox:
Create a new listbox, and choose 'Expression' from list of fields. Now put If(Field=Field1 or Field=Field2, Field) as your Expression to show only Field1 and Field2 values in the lsitbox.
2. Use a new table in the model, linking to the desired field, but with only the values that you want to display. Use this dimension in the Listbox.
There are two ways (At least)
1. Use Calculated dimension or Expression in the listBox:
Create a new listbox, and choose 'Expression' from list of fields. Now put If(Field=Field1 or Field=Field2, Field) as your Expression to show only Field1 and Field2 values in the lsitbox.
2. Use a new table in the model, linking to the desired field, but with only the values that you want to display. Use this dimension in the Listbox.
Works Perfect!
Thansk 🙂
Hi all,
Using if statement to restrict rows in a listbox is fine when w2e have only 2 to 3 rows. what is the method to restrict rows in a listbox when there are 100 + rows???
There are plenty of ways to do it.
One:
WORD FLAG_SHOW
Waiting" 1
"Connect 1
* 0
Two:
create a table with the values and join with the dimension tables
and it goes...
Adrian,
the first way you suggested is good for the case when we have 10 or 20 rows in that listbox(table). In my case, there are arond 1000 rows in that listbox, but for a particular chart where I am using this listbox I want to have only 10 of these rows.
Can you please elaborate the second case?
Actually it is not 10, I just gave a number.
there is one more thng to this. In the actual table there is one more column called line_no. I want all the categories for which line_no = 1 .
Ex:
Line | Category2 |
---|---|
1 | a |
1 | b |
1 | c |
2 | d |
2 | e |
3 | f |
3 | g |
Like this, there are more than 1000 rows and I want all the categories for which line_no=1. since we are not using an aggregate function, we cannot use set analysis here. So is there a way?
Thanks Mayil!
Load *,line_no,Category2 from tablename where line_no = 1; but this query restricts all the columns to line_no = 1.
can't we place the restriction on one column?
I think the abve query makes more sense though
hi,
Try this,
Load *,line_no,if(line_no = 1,Category2) as Category2 from tablename;
Hope it helps.
thanks !
that works!