Softdial Scripter™
Designer - Subscripts Tutorial
3) Editing MySubscript
Adding Script Fields
The MySubscript script needs two Script fields for later use.
In the central design area, click on the MySubscript tab:
- In the left panel, click on the Script Fields tab.
- Click Add at the bottom.
- In the Add New Field dialog box that appears, enter the following:
- Name: type UserPrompt (Fig. 1),
Fig. 1 - Add New Field - UserPrompt
- Value: this is not required as it will be provided by the Set Field step.
- Click OK. The UserPrompt field should now appear in the Script Fields list on the left.
- Repeat steps 3-5 to add another script field with the NameUserResult now. Again, leave Value empty. We are going to need this for the result of the calculation to be passed back to MySubscriptSubscript later.
Further editing
While on the MySubscript script tab:
- On the left, click on the Script Resources tab.
- Using Fig. 4 as a guide, drag the following components onto the script flow:
- Set Field x 2 - from the Script Flow folder,
- Math - from the Math folder,
- MySubscriptSubscript x 2 - from the Subscripts folder.
- In the script flow, double-click the first Set Field step:
- Inputs tab > Value, type Enter a number :,
- Outputs tab > Value, right click and select Insert Script Field > UserPrompt,
The format of the entry that is created is ${var:UserPrompt}.
Fig. 2 - Set Field Input/ Output
- Click OK.
- The information in the UserPrompt field must be passed to MySubscriptSubscript. Subscripts do not have access to script fields from other scripts by default so we need to configure access by using the Set Subscript Inputs and Outputs feature, found in the Scripts menu. We will do this when discussing the MySubscriptSubscript script.
- Double click the Math step:
- Inputs tab >
- First/ Second Number - as we are going to square this value, we set both inputs to UserResult. Right click each field and select Insert Script Field > UserResult.
- Operator - select * (multiply).
- Outputs tab > Result - type UserResult. The output of the calculation is written back to the UserResult field
.
Fig. 3 - Example Math Input/ Output
- Double click the second Set Field step, and configure in the same way as the first:
- Inputs tab > Value, type The square of the number is :
- Outputs tab > Value, right click and select Insert Script Field > UserPrompt.
- The UserPrompt field and the UserResult field are again passed to MySubscriptSubscript for display to the user.
Your MySubscript.xml tab will now look similar to Fig. 4.
Fig. 4 - MySubscript.xml Example
Next: 4) Editing MySubscriptSubscript