Presentation is loading. Please wait.

Presentation is loading. Please wait.

Interactive Scripts: Intermediate. Error Trapping When requesting user input, it is imperative that the users enter the data in the desired format. Dropdown,

Similar presentations


Presentation on theme: "Interactive Scripts: Intermediate. Error Trapping When requesting user input, it is imperative that the users enter the data in the desired format. Dropdown,"— Presentation transcript:

1 Interactive Scripts: Intermediate

2 Error Trapping When requesting user input, it is imperative that the users enter the data in the desired format. Dropdown, radio buttons, and check boxes provide the user with limited options. The Edit Box and ACCEPT() Commands, however, allow the users to enter data in a free flow manner. Entering invalid data can cause the script to crash or produce invalid results. In order to avoid this, users should engage in a practice known as Error Trapping.

3 The Error Trapping Principle The way an error trap works is that it will repeat a script until the conditions for acceptable data are met. This generally means: 1)Define a flag to monitor the conditions. 2)Execute a subscript so long as the conditions are not met. 3)At the end of the subscript, check to see if the conditions are met. If they are, then change the flag ending the script.

4 Example 1: While writing a script, you wish to ask the user for a minimum dollar amount. You only want numerics, a maximum of one period, and negative signs.

5 Script ASSIGN v_flag = F DO subscript WHILE v_flag = F

6 Subscript V_flag = T ACCEPT "Enter minimum amount" TO v_minimum COM If the value entered contains anything other than a COM numeric/negative sign/period then the flag will be set to zero COM causing the subscript to be rerun and the script to pause with a COM message to the user explaining what the problem is. IF EXCLUDE(v_minimum, " ") <> " " and OCCURS(v_minimum, ". ")<=1 ASSIGN v_flag = F IF v_flag = F PAUSE Please use only numbers, periods, and negative signs.

7 Lists Using one of the methods described above, youve created a list. Using this list, you want to plug it into a dropdown box asking the user to select a value. This is very easy to accomplish. As dialogue boxes can be complex to write, it is often easiest to use the ACL Dialogue Wizard to write the skeleton for your script.

8 Dialogue script list: DIALOG (DIALOG TITLE "User Dialog" WIDTH 494 HEIGHT 159 ) (BUTTONSET TITLE "&OK;&Cancel" AT DEFAULT 1 ) (DROPDOWN TITLE "variable1;variable2;variable3" TO "DROPDOWN1" AT DEFAULT 2 ) (TEXT TITLE "test" AT )

9 Dialog Command broken down: DIALOG ---Invokes the Dialog Command (DIALOG TITLE "User Dialog" WIDTH 494 HEIGHT 159 ) ---Defines the width and height of dialog box. (BUTTONSET TITLE "&OK;&Cancel" AT DEFAULT 1 ) --- Positions the OK/Cancel button at position over 370 spaces and down 12. (DROPDOWN TITLE "variable1;variable2;variable3" ---this is the list of items within the dropdown list. TO "DROPDOWN1" ---The default variable name assigned by ACL. AT Locates the drop down at 24 over and 84 down. DEFAULT 2 ) ---Defines the default value as the second value in the list. A field does not require a DEFAULT value. (TEXT TITLE "test" AT ) ---Locates text at position 24 over and 52 down.

10 Dialog Script project item DIALOG ---Invokes the Dialog Command (DIALOG TITLE "User Dialog" WIDTH 459 HEIGHT 159 ) ---Defines the width and height of dialog box. (BUTTONSET TITLE "&OK;&Cancel" AT DEFAULT 1 ) --- Positions the OK/Cancel button at position over 370 spaces and down 12. (ITEM TITLE "NCD" ---NCD indicates that the dropdown box will include Numerics, Character and Date fields. TO "ITEM1" ---Item1 is the default variable name assigned by ACL. AT WIDTH The dropdown will appear 48 spaces over and 60 down with a width of 255. DEFAULT "test" ) ---The default value will be test.

11 Data Normalization When using interactive scripts, it is often necessary to normalize the data to ensure accurate data analysis. This can concern both the data contained within the field and the description of the field itself.

12 Modifying Data in Fields Often times in order to perform an analysis, the data must be normalized within the fields themselves. The use of functions such as UPPER() or ALLTRIM() commands is much more important with interactive scripts than it is with non- interactive scripts.


Download ppt "Interactive Scripts: Intermediate. Error Trapping When requesting user input, it is imperative that the users enter the data in the desired format. Dropdown,"

Similar presentations


Ads by Google