BookmarkSubscribeRSS Feed

How to prompt for a date range in a SAS VA report – Example 4 Text input

Started ‎06-04-2020 by
Modified ‎06-04-2020 by
Views 2,889

I’ve broken this topic down into a four-part series to make it easier to consume and to save you from copious amounts of scrolling. The accompanying video tutorial is already available and the below examples are linked to their corresponding timestamps in the video.

 

The control objects and examples I will cover in this series include:

Example 4: Text input

In this example, I prompt the user to enter two date values via the Text input control object. Using the text input control object is ideal when you have a lot of values to select from and where it doesn’t make sense to use a drop-down list or slider control object. The “a lot” threshold will ultimately depend on your users and how they want to enter their values, but I would classify anything over a couple hundred values as being a good candidate for a text input control.

 

The format for the text input control object will be driven by the assigned roles and matching parameter’s format. Once the user enters a From and To date then these values are used in a common filter for the List table and Line chart. The Targeted bar chart does not have a filter applied. This is because I’m comparing all three years’ worth of data I have available in the data source. I want the targeted bar chart to be a static object for this page of the report.

 

01_TextInput_Example4-1024x556.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

The technique used in this example will follow these steps:

  1. Add two Text input control objects to the report canvas and assign Roles
  2. Create two parameters and assign to the control objects’ Roles
  3. Define Filters for report objects

Step 1: Add two Text input control objects to the report canvas and assign Roles

Use the page’s overflow menu to Expand page controls so that it is easy to see where you are dragging the Text input control objects. Do not place the control object in the Page prompt area, but directly under it in the report canvas. Remember, we need two!

 

02_AddTextInputObjects-1024x653.png

 

Next, we need to assign the Roles and use the object’s Title Option to label our control objects to assist our report users.

 

The first text input control object is configured like this:

 

03_FromTextInputConfiguration-1024x308.png

 

The second text input control object is configured similarly:

 

04_ToTextInputConfiguration-1024x307.png

Step 2: Create two parameters and assign to the control objects’ Roles

Now we will need to create two parameters to store the selected values from the Text input control objects so that we can use these values in our filter expression.

 

From the Data pane, use the New data item menu and select Parameter. Enter the new parameter information for the date data item. Be sure to select the correct Type and Format.

 

05_FromDateParameter.png

 

The second parameter is configured similarly. It is useful to give the parameters meaningful names.

 

06_ToDateParameter.png

 

Next, we need to assign these parameters to their corresponding Text input control objects’ Roles so that it stores the value entered.

 

07_AssignDateParameters-1024x653.png

Step 3: Define Filters for report objects

Now we have our date boundaries which are being entered via the Text input control objects and stored in our two parameters. Next, we need to define and apply our Filter to our report objects.

 

First, we will define the filter for the List table object. Next, we will convert it to a common filter and then apply the common filter to the Line chart object. Recall that we want this to be a between inclusive for our two boundary values. Select the List table object and then use the Filter pane and from the New filter menu select Advanced filter.

 

08_ListTableFilter-1024x653.png

 

Next, use the expression editor to build the filter for the Date data item using the between inclusive condition and the two parameter data items as the lower and upper boundaries.

 

Since we will be converting this filter to a common filter, be sure to give it a meaningful name.

 

09_FromToDateFilterExpression-1024x595.png

 

Time to convert this filter to a common filter. For more information about common filters see my previous article or my YouTube video.

 

With the List table still the active object, from the Filters pane use the filter we just created, FromToDateFilter’s overflow menu and select Change to common filter.

 

10_ChangeToCommonFilter-1024x449.png

 

Now we can apply this filter to the Line chart. Select the Line chart to activate it. Then from the Filters pane use the + New filter menu and apply the common filter named FromToDateFilter.

 

11_LineChartFilter-1024x668.png

 

Success! You have now configured your control objects to successfully filter the List table and Line chart objects.

 

Pro Tip: If you want to always ensure that your To value is always greater than your From value then you can add an additional filter to the To Text input control object.

 

With the To Text input object selected, use the Filter pane and from the New filter menu, select Advanced filter.

 

Configure the filter for the Date data item using the FromDateParameter.

 

12_PromptFilter-1024x668.png

 

Here’s a summary of the technique for Example 4: Text input:

  1. Add two Text input control objects to the report canvas and assign Roles
  2. Create two parameters and assign to the control objects’ Roles
  3. Define Filters for report objects

How to prompt for a date range in a SAS Visual Analytics report:

Other References

Version history
Last update:
‎06-04-2020 12:55 PM
Updated by:
Contributors

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags