Forum/KB - Report Authoring

Use JavaScript to reset report objects

Ben Huang
posted this on March 16, 2011 13:41

Step 1: After configuring a Vantagized  report, add a HTML Item after Vantage Definition Scripts.

html_item.PNG

 

Step 2: Paste the following JavaScript into this HTML Item.

<script language="JavaScript">
function reset(queryList){
var queryList=new Array("CrosstabQuery","ChartQuery1","ChartQuery2");
  for (var i=0; i<queryList.length; i++) {
if (queryList[i] in vipReport.queries) {
vipReport.distBroadcast(queryList[i],"{'type':'cognosFilter','content':'1=1'}");
} else {
vipReport.distBroadcast(queryList[i],"");
}
  }
}
</script>

<script language="JavaScript">

      function vantageReset() {

                 var queryList=new Array("CrosstabQuery","ChartQuery1","ChartQuery2"); 

                 for (var i=0; i<queryList.length; i++)

                      {if (queryList[i] in vipReport.queries)

                           {vipReport.distBroadcast(queryList[i],"{'type':'cognosFilter','content':'1=1'}"); }

                       else

                          {vipReport.distBroadcast(queryList[i],""); }  

                      }

     }

</script>

 

Step 3: Replace "CrosstabQuery", "ChartQuery1", "ChartQuery2" with the queries needed to be reset in the report.

 

Step 4: Add another HTML Item into the report.

 

Step 5: Paste the following JavaScript into this HTML Item to create a button.

<button onclick="vantageReset()">Reset</button>

 

Step 6: Use this button to reset report objects.

 

Comments latest first

User photo
Engelbert Wijnhoven

Why do I need to use this javascript? Does something not work without it?

August 16, 2011 14:03