BookmarkSubscribeRSS Feed
plapa29
Calcite | Level 5

Hi All,

I am trying to link a Text Input control to more than 1 category in SAS VA. I can only select 1 category. Is there a workaround? How can this be done?

10 REPLIES 10
Sam_SAS
SAS Employee
By assigning a parameter to the the text input, you could you create filters based on that parameter for each of the categories.

There may be other ways, but this is the first thing that comes to mind.

Sam
mipate
SAS Employee

Yes indeed it is possible.


Step 1: Create a parameter in the data tab and give it some name (for this case lets say you have two columns in your table name A and B where both are text and you want to have the search bar index on both of them).

 

Step 2: Create a new calculated column and name it something along the lines of rowShouldAppearInSearch. We want this to be a text column, 'true' if either A or B in the current row contains the current value of the parameter, false otherwise. To do this, have an if statement. If the length of the parameter is 0, return true (no parameter means we have no search restrictions). Else, if A contains parameter or B contains parameter, return true. Else, return false.

 

Step 3: Update your table to filter based on the calculated columns. So select the parameter to filter on, and then choose to filter to only include values of rowShouldAppearInSearch which are true.

 

Let me know if you get stuck on any of this. Otherwise, I hope I was able to help you out!

plapa29
Calcite | Level 5
Hi Mipate,

Thank you for your response. However, I still need help on this topic. Is there a video tutorial to link more than one categories to a Text Input? Alternatively, I will appreciate a quick call to guide me on this. Thank you
J_J_J
Obsidian | Level 7

Hi!
I have 5 characters and create a character parameter and assign it to a text input:
( ( 'parameter'p NotMissing ) AND ( 'character'n Contains UpCase('parameter'p ) ) ) OR
( ( 'parameter1'n NotMissing ) AND ( 'character1'n Contains UpCase( 'parameter1'n) ) ) OR
( ( 'parameter2'n NotMissing ) AND ( 'character1'n Contains UpCase( 'parameter2'n) ) ) OR
( ( 'parameter3'n NotMissing ) AND ( 'character1'n Contains UpCase( 'parameter3'n) ) ) OR
( ( 'parameter4'n NotMissing ) AND ( 'character1'n Contains UpCase( 'parameter4'n) ) )
But in this case one text input controle doesn't affect others text input controles, but would like to link a Text Input control to more than 1 category

Example:


example.PNG

where colour is 'parameter'p and 'character'n, name is  'parameter1'n and  'character1'n  etc.

I tied to do, using your advice, but I do something wrong:

 

IF ( GetLength('parameter'p) > 0 )
RETURN
(
(IF ('parameter'p NotMissing ) AND ( 'character'n Contains UpCase('parameter'p) )
ELSE ( 0 = 1 )
)
OR
(IF ('parameter1'p NotMissing ) AND ( 'character1'n Contains UpCase('parameter1'p) )
ELSE ( 0 = 1 )
)
ELSE ( 1 = 1 )

Could you help me with it please?

Sam_SAS
SAS Employee

To perform case-insensitive matching, you should apply UpCase() to both the parameter value and the category value:

 

UpCase('character'n) Contains UpCase('parameter'p)

 

In the example that you show, there appear to be separate text input controls for each category that you want to filter. If there is not a one-to-many mapping, then you would not need to worry about parameters and complex expressions.

 

But perhaps I am misunderstanding something?

 

Sam

J_J_J
Obsidian | Level 7

Thank you Sam! 

I solved this in the other way:

 

( 'parameter'p NotMissing ) AND ( ( 'character'n Contains UpCase(
'parameter'p) ) AND ( 'character1'n Contains UpCase('parameter1'p) ) ) AND (
'character2'n Contains UpCase('parameter2'p) )

Sam_SAS
SAS Employee

Glad to hear you've got it working 🙂 Thanks for sharing your solution with us.

 

Sam

plapa29
Calcite | Level 5
Hi Sam,

Thank you for taking the time to respond to my inquiry. However, I still need help on this topic. Is there a video tutorial to link more than one categories to a Text Input? Alternatively, I will appreciate a quick call to guide me on this. Thank you
Sam_SAS
SAS Employee

Depending on the version of VA you have, it might not be possible. I don't remember how it was in 7.4 and earlier.

 

If you go to the Data pane and create a character parameter, then assign that parameter to the Text Input control, you should be able to retrieve the value from the text input field and then you can use that parameter value in filters.

 

hybrid.gif

 

For example, here I have cars data where you might find "Hybrid" in both the 'Model' column and the 'Type' column. I created a parameter and assigned it to a Text Input control, then made an advanced filter for each of the two list tables.

 

The filter expressions are:

 

'Type'n Contains 'Parameter 1'p

and 

'Model'n Contains 'Parameter 1'p

 

I'm not sure if this sort of filtering is what you have in mind, but I thought it might help. In this example, I don't have a category assigned to the text input and the user can enter whatever string they want. But the objects filtered by the parameter won't show data until a value is entered in the text input.

 

If you need a lot of step-by-step assistance, a call to SAS Technical Support is probably a good idea.

 

Let us know if this helps,

Sam

acordes
Rhodochrosite | Level 12

You can create a multi-value parameter using the list input object.

this can be used i.e. in a prompt container. 

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 10 replies
  • 1946 views
  • 2 likes
  • 5 in conversation