Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index > Multi-User Guide > Increasing Performance in Forms

Command Syntax in EEPs

Scroll Prev Top Next More

As more and more R:BASE users discover just how powerful Entry/Exit Procedures (EEPs) can be in forms processing, several methods have emerged that can help improve their performance.

 

Use Custom EEPs and Custom Form Actions

With the enhancement that all Custom Form Actions and Custom EEPs (Forms/Reports/Labels) are executed in memory instead of temporary files (version 7.6 and higher), another way to speed up the execution of EEPs is to move all the command file EEPs to Custom EEPs. This eliminates the need for R:BASE to create the temporary files to the disk when executing a command file EEP. You can make the transition to Custom EEPs by performing the following:

 

1.In the Form Designer, select one of the controls which references a command file EEP.
2.Right click on the control and select "Properties'.
3.From the "EEPs" tab, select the "Edit EEP..." button, which will display your EEP code in the R:BASE Editor.
4.Use the keyboard shortcut [Ctrl] + [A] to highlight the entire contents of the command file EEP.
5.Use the keyboard shortcut [Ctrl] + [C] to copy the contents to the Windows clipboard.
6.Close the R:BASE Editor window to return to the control properties dialog.
7.Select the "Edit Custom EEP..." button, which will open the R:BASE Editor to store the code, only this time the commands will be stored within the form itself.
8.Use the keyboard shortcut [Ctrl] + [V] to paste the entire contents of the command file EEP.
9.Select the "OK" button to return to the control properties dialog.
10.Remove the EEP file name from the "Custom" field so the EEP does not fire from the command and the Custom EEP, and only the Custom EEP.

 

The control properties dialog should now alter the color of the "Edit Custom EEP..." button to yellow.

 

Leave the EEP Quickly

When writing an EEP, decide in the first couple of lines whether the user is going to stay in the EEP or return to the form. For example, let's say you want the user to execute hundreds of lines of code if they press [F2] inside a field. Here is one way to accomplish this:

 

SET VAR vLAST = (LASTKEY(0))

IF vLAST = '[F2]' THEN

{HUNDREDS OF LINES OF CODE}

ENDIF

RETURN

 

This EEP will work, but even if the user doesn't press [F2], it requires the reading of hundreds of lines of code. The following structure is more efficient:

 

SET VAR vLAST = (LASTKEY(0))

IF vLAST <> '[F2]' THEN

 RETURN

ENDIF

 {HUNDREDS OF LINES OF CODE}

RETURN

 

This EEP is quicker because if the user doesn't press [F2], it evaluates only four lines of code. The bulk of the code is evaluated only if the user does press [F2]. So, when processing lots of conditional commands, use a GOTO command to jump to the end of the command file or use a RETURN command as soon as the process is completed.

 

Keep the User Informed

Speed is a matter of perception as much as a value to measure. In fact, the fastest EEP is only as fast as the user perceives it to be. Even if your EEP takes only 10 seconds or less to execute, by not informing the user that something is going on, you risk leaving the impression that something is wrong with the form.

 

To prevent user frustration, put a PAUSE command at the beginning of the EEP that lets the user know the EEP is being processed. Something like "Calculating ... Please Stand By ..." is probably sufficient. Example code for a PAUSE dialog with an oscillating gauge can be something like:

 

PAUSE 3 USING 'Calculating ... Please Stand By ...' +

CAPTION 'Calculating ...' ICON APP +

OPTION GAUGE_VISIBLE ON +

|GAUGE_COLOR [R218,G228,B246] +

|GAUGE_INTERVAL 10 +

|MESSAGE_FONT_NAME VERDANA +

|MESSAGE_FONT_SIZE 10 +

|MESSAGE_FONT_COLOR BLUE +

|THEMENAME Razzmatazz

-- Put your code, that takes a lot of time, here ...

-- Use CLS command to clear the PAUSE 3 dialog

CLS

RETURN