When Data-Driven Content (DDC) object was first added to SAS Visual Analytics (version 8.2), I wrote a two-part article to explain the concept and help introduce its basics. At that time, we explored the key elements that are provided in the json message that the DDC receives from the SAS Visual Analytics report: resultName, data, and columns. Intentionally, I didn’t include parameters, but now that people have adventured through Data-Driven Content, I started to get questions about accessing parameters and their values from the DDC Java Script code.
Information about parameters can be found in the json message and its structure is very similar to columns, but the parameters element isn’t always present in the message.
The parameters element is optional, and it only shows up in the message if there is a parameter used by the Data-Driven Content object, for example:
For each parameter added to the message, you will get at least its name (internal id), label, datatype, and value. The value can be a single value or an array, if the parameter accepts multiple values. This is an example of a parameter called “pTypeMultiple” that has three string values assigned to it:If a parameter is formatted, the format information is included. The example below shows a parameter “pDiscountPct” with a value of 18%:
You saw previously that parameters must be used by the DDC object (in calculation, filter, or rank) for them to be added to the json message. What if you still want to have access to parameters and their values, but the parameter is not used in any calculation, filter, or rank? The answer is simple: you will have to add one of those elements, even if you don’t really need them. For example, you can add a dummy advanced filter that returns true always, so it won’t affect the results, such as:
If you want to play around with parameters in DDC, I highly recommend you try the sample DDC available in GitHub called jsonDataViewer.html. This sample DDC displays the json message and it makes it easier to visualize what’s being passed from VA to the DDC object. The easiest way to use the sample is to add the URL below to the Options pane of your DDC object:
The video below contains an example of a DDC with calculated item, rank, and filter.
If you want to explore this example in your environment, I've attached the CARS dataset that should be loaded in the Public CAS library and the report as a json file that you can import from SAS Environment Manager (menu option Manage Environment).
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.