BookmarkSubscribeRSS Feed
Charis_Saliaris
Fluorite | Level 6

Hello,

 

I am trying to filter a report using the option of data-driven html form, but I can't return the selected value of the buttons in the report, the buttons are created in the html form.

 

Below is the code i use:

 

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="../util/messagingUtil.js"></script>
<script type="text/javascript" src="./util/contentUtil.js"></script>
<title>SAS</title>
</head>

 

    <body>
<h1>HTML DOM Events</h1>
<h2>The onclick Event</h2>

<p>Select one the following choices:</p>

<div id="buttons"> 
<button id="option1" onclick="selectOption('A')">A</button> 
<button id="option2" onclick="selectOption('B')">B</button> 
</div>
<div id="result"> 
<p> </p>
<p> </p>
</div>
<script>

 
        function selectOption(text) {
            let selectedText;
            var selection=[];
            var vaResultName;
            selectedText = text;

            document.getElementById("result").innerHTML = selectedText;
            selection.push(selectedText){
                return test == selectedText        
            }));
         

 

            va.messagingUtil.postSelectionMessage(vaResultName, selection);
            x.innerHTML= "Your selection is " + test;
        }

</script>

</body>
</html>

 

What needs to change to return my variable to the report?

 

Thanks,

Charis

1 REPLY 1
Mickey_SAS
SAS Employee

You will need to follow the api for handling selections and posting those back to the report, I'm assuming you want your DDC to be used as the source of an action.

 

Here is the doc for this, as well as an example from github

https://go.documentation.sas.com/doc/en/vacdc/v_017/varef/n109mqtyl6quiun1mwfgtcn2s68b.htm#n1ua0gttq...

https://github.com/sassoftware/sas-visualanalytics-thirdpartyvisualizations/blob/master/samples/mult...

 

 

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
  • 1 reply
  • 262 views
  • 0 likes
  • 2 in conversation