BookmarkSubscribeRSS Feed
mattneo
Obsidian | Level 7

I have a list of table containing thousand rows of case IDs. I want to search more than 1 case IDs at one go, say 202001 and 202002, so that the table only display this 2 cases for me to compare the entries.

 

So far I see there are two ways but they are have limitations:

 

Method 1: link . Based on this previous thread, one way is to parse the inputs into separate terms. How does one do that? Even so, this method is not scalable; it's hard to say how many search terms the user may entered at any point in time.

Method 2: I added a Prompt container at the report section. Added 2 text input boxes in it. However, when I entered 202001 in the first box, and entered 202002 in the second box, the list table did not show the results as expected. Any idea why this did not work? Anyway,this method is also not scalable.

 

Any ideas for a scalable and "flexible" approach to searching multiple terms in SAS VA?

7 REPLIES 7
Jim_Ogilvie
Obsidian | Level 7

Hi Matt,

 

Sounds like a wildcard approach would give you the greatest flexibility.

 

You could use one search box and have your users either type the entire string, or if they want to see a range of cases, then use wildcards.

 

Have a read here for how to implement:

 

https://communities.sas.com/t5/SAS-Visual-Analytics/VA-quot-contains-quot-search-in-input-text-box/t... 

 

Doing this with 2 search boxes would provide even greater flexibility (but with the cost of increased logic).

mattneo
Obsidian | Level 7

Hi Jim,

 

Thanks for the reply. Interesting link there you have provided. However, this "wildcard" solution seemed applicable only for words. For example if you entered "cat", then the results would show " Catherine", "Catie" etc. But my search queries are now numeric in nature; case IDs like 2020xxxxx01, 2020xxxxx02. 

 

So when user search the two case IDs, or three, or four or more, the list table should only show the case IDs queried. Any ideas?

Jim_Ogilvie
Obsidian | Level 7

Yes Matt, simply change the variable type of case_id from numeric to character.

 

If it is vital that case_id stays numeric (for other parts of the report), then just take a copy of it instead and change the copied variable's type to character, for use just on the pages where you want to search.

 

 

Once you have a character variable, this will work perfectly for you, I had the same thing running at my previous job.

mattneo
Obsidian | Level 7

Hi Jim. But how should the user entered the queries? If there was only one text input box, should user enter "2020xxxxx01 ; 2020xxxxx02" in it? Would SAS VA automatically recognize the delimiter ";" in the text input box, and recognized two terms? What is the best way to enter multiple terms?

Jim_Ogilvie
Obsidian | Level 7

Hi Matt,

 

If you implement as per the link, but use "Begin" in stead of "Contains",  I would then advise users to search by typing, 20200, for example.

 

This should then filter for 202001, 202002, 202003... 202009 

 

 

If you had another search box implemented in the same way, you could do "searchbox1" or "searchbox2", allowing them to get two exact case_id, or one or two case_id ranges.

mattneo
Obsidian | Level 7

Hi Jim. What if the user already know the exact case IDs, and just want to extract the details of them in the list table? (Hence no need for an range of results) Say the case IDs are 202001, 201901 and 201801. Is there a way to do so in a single search box? Or I would need three search boxes? The idea is to allow flexibility in the number of search terms, without being restricted by the number of search boxes.

Jim_Ogilvie
Obsidian | Level 7

You might be able to code up something that searched for multiple case_id's using "IN"...

 

But then you would use the other functionality we discussed above.

 

 

You could use as many search boxes as necessary... 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1480 views
  • 0 likes
  • 2 in conversation