Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Restrict contents of a list box

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

1 Solution

Accepted Solutions
Not applicable
Author

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.

View solution in original post

12 Replies
Not applicable
Author

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.

Not applicable
Author

Works Perfect!

Thansk 🙂

Not applicable
Author

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

Not applicable
Author

There are plenty of ways to do it.

One:

  • create a map on load script; TESTMAP: LOAD MAPPING INLINE ....
  • put all the words you want on it.

WORD     FLAG_SHOW

Waiting"     1

"Connect   1

*                  0

  • create a new column on the table and apply the map. it will work as a flag field. Applymap(TESTMAP, DIMENSION)
  • use the if (FLAG_DIM  =1, ...)

Two:

     create a table with the values and join with the dimension tables

and it goes...

Not applicable
Author

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?

Not applicable
Author

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:

LineCategory2
1a
1b
1c
2d
2e
3f
3g

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?

Not applicable
Author

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

MayilVahanan

hi,

     Try this,

      Load *,line_no,if(line_no = 1,Category2) as Category2 from tablename;

     Hope it helps.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

thanks !

that works!