Using the "Same Condition as Previous" Setting

Description

The condition for an action can be copied to other actions that use the same conditions using the Action is conditional and Same as Previous option.

Some of the examples in this guide require the "Learning Action Scripting" workspace. See Creating Your First Action Script to learn how to get the "Learning Action Scripting" workspace installed.

If an Action uses the same condition as the action before it, there is a simple technique to copy the condition.

Add a third Action to your Action Script that opens the Default Form for the Customer table. This action will be conditional, using the same condition as the "Display a Message Box" Action.

  1. If you're not already editing the Lesson1 script, open it in the Code Editor.

  2. Select the "Display a Message Box" Action.

  3. Click the Add New Action button.

  4. Select the "Form/Browse" category and the "Open Default Form or Browse" Action. Click OK to select this Action. Alpha Anywhere displays the Open Default Form or Browse Genie.

  5. To open the default form for the Customer table, select "customer" in the For which Table/Set? list and click Next >.

  6. We want the default form to show all records. Select "No additional selection criteria" then click Next > and Finish to complete the Action.

  7. Check the Action is conditional and Same as Previous condition fields. Note that the icon to the left of "Open Default Form or Browse" is now a "ditto" mark, indicating that the action's condition is the same as the previous Action's condition.

    The Same as Previous condition field only appears when the action immediately above it is conditional. If you select the "Display a Message Box" action, the prompt disappears.
  8. Save your script and run it to test it. You will see the form is only opened if you enter a non-null value at the first prompt.

  9. Click the View Xbasic button again to see all the work Action Scripting has automated for you.

Limitations

Desktop Applications Only