I. Description
1. Problem description
Dashboard does not support thedata entry preview in cpt file, so how can the user realize the data entry function of the dashboard?
2. Solution
1) Users can add the submit button widget to realize the function of dashboard data entry.
2) Users can add a web box widget plugin to insert a report to realize the function of dashboard data entry.
II. Example 1
By adding the submit button widget, the dashboard data entry is realized
1. Report design
Create a new dashboard. The report design is shown in the figure below
The label widget on the left describes the widgets on the right. Modify the widget names and value for the widgetsl on the right. The submit button is at the bottom. The details are as follows:
Description | Widget type | name | value | data dictionary |
---|---|---|---|---|
Name | Text Field | name | if(len($fine_username)=0,"admin",$fine_username) | none |
Type | Drop-down box | type | none | personal leave, annual leave, sick leave |
Start time | date | startday | now() | none |
End time | date | endday | now() | none |
Days off | Text Field | day | DATEDIF($startday,$endday,"D")+1 | none |
Reason | Text Area | reason | none | none |
Submit | Button | submit | none | none |
2. Mobile terminal style adjustment
Adjust the width and height of the dashboard, and cancel the App Relayout of the mobile terminal, as shown in the figure below:
3. Commit to Database event
Select the submit button widget and click event to add a click event
Add a commit to database event. The table is Absence, and the corresponding values are as follows:
Note: the value is preceded by a $sign, which means that the parameter is referenced.
4. Setting callback function
At this time, if the report is successful/failed, there is no prompt.
Therefore, you need to set a callback function to prompt the user whether the data entry is successful or not. As shown in the figure below:
JS code is as follows:
if (fr_submitinfo.success) {
FR.Msg.toast('Submit successfully!');
} else {
FR.Msg.toast('Submit failed!');
}
Note: success only means that there is no exception in the background program execution, and does not mean that the data is submitted successfully.
5. Effect preview
Save the template and click preview. The effect is as follows:
III. Example 2
By adding a web box widget plugin to insert a report, the function of dashboard data entry is realized.
Note: mobile terminal does not support web box widget
1. Installing plugin
Contact technical support to install the webpage box widget plugin: support@fanruan.com or https://fanruanhelp.zendesk.com/hc/en-us
2. Add webpage box widget
Select widget > webpage box widget, drag it to the body box of dashboard, as shown in the figure below:
3. Setting address and parameters
Select the webpage box widget, and click Widget Settings > Attributes > Addressto set the corresponding template (template path or network template), as shown in the figure below:
Note: If you found the template is not able to enter data, you can add & OP = write at the end of the template URL.
4. Effect preview
Save the template and select preview. The effect is the same as II.5 becuase we are using the same template.
Note: mobile terminal does not support
IV. Completed template
1. Example 1:
For completed templates, please refer to:
%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Data Entry\DEDashboard1.frm
Click to download the template: DEDashboard1.frm
2. Example 2:
For completed templates, please refer to:
%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Data Entry\DEDashboard2.frm
Click to download the template: DEDashboard2.frm