I. Overview
1.1 Requirement
When design a decision-making report, how to use button widget for the body of the decision-making report or use report block hyperlinks to get the value of parameter widget?
1.2 Solution
Use JS to get the value of parameter widget:
_g().parameterEl.getWidgetByName('text').getValue();
// Use the button widget for the body of the decision-making report to get the value of parameter widget.
II. Sample
2.1 Design a new decision-making report
1) Create a new decision-making report and drag it into the parameter pane. Add a textbox and a query button in the parameter pane. Set the textbox widget as text and the widget value as I`m a parameter widget, as shown below:
2)Click the white space of the parameter pane, and uncheck Display Nothing Before Query, as shown below:
3) Drag a button widget and a report block into the body of the decision-making report. Label the button as Get the value of parameter widget, as shown below:
2.2 Add a click event
Select the button widget, choose the [Event] and add a Click Event, as shown below:
Input the JS code:
alert(_g().parameterEl.getWidgetByName('text').getValue()); // Get the value of parameter widget for textbox text.
2.3 Add hyperlinks to the report block
Select the report block and add [Edit]. Enter [Get the value of parameter widget] in A1, right click A1, click [Hyperlink], and add JavaScript, as shown below:
Input the JS code:
alert(_g().parameterEl.getWidgetByName('text').getValue());//Get the value of parameter widget for textbox text.
2.4 Preview
Save the template and choose [Preview]. Click the button widget or the text in the report block to get the value of parameter widget.