To continue with this content, please log in with your Data Access ID or create a new account.
Cancel Data Access ID
You may not be authorized to see this content. Please contact Data Access Europe for more information.
Cancel Data Access Europe
You are not authorized to see this content.
Cancel Data Access Europe
Next lesson:
Functions and Procedures
Cancel

Learn the Language

Lesson 3: Flow control

Now that we know how to use variables, let’s see how you can control the flow of your application.

Demonstration

1. Click PROJECTS NEW > PROJECT > BASIC PROJECT > OK

2. Name your project, in this case FlowControl > OK

3. Clear out the code it generated and replace with:

Use:

DfAllEnt.pkg

Add:

Procedure DemoIf

Add:

Send DemoIf

4. Define a variable:

String sMessage

5. Add the following line to your code

If (DateGetHour( CurrentDateTime()) < 12) Begin

6. Add the following line to your code

Move “Good morning” to sMessage

7. Add the following line to your code

Else Begin

8. Add the following line to your code

Move “Good Day” to sMessage

9. Add the following line to your code

Send Info_Box sMessage

10. Click on RUN (F5) and an info box should appear saying “Good morning” or “Good day” depending on your current time.

11. We can extend this, by adding: Else If (DateGetHour( CurrentDateTime()) < 18) Begin

12. Add the following line to your code:

Move “Good afternoon” to sMessage


13. Click on RUN (F5) and depending on what time it is for you, the info box will say: “Good Morning”, “Good afternoon” or “Good day”.