generate/cbs2.gif Screen Builder Formulas generate/sbfield31.gif


 

You may place CAPITAL Business Script 'behind' a field in order to perform special calculations. Scripts may consist of a combination of functions, statements (commands) and mathematical operations.

For more information on CAPITAL Business Script see the topic: CAPITAL Business Script found in the CAPITAL Visual Builder Help File.

For information on CAPITAL Business Script functions specific to the Screen Builder see: Screen Builder Script Functions.

Functions

Press this button to display a list of available general-purpose script functions.

Operations

Press this button to display a list of valid script operators.

Statements

Press this button to view a list of recognised script statements/commands.

Test

Press this button to test a script.

generate/mistake1.gif Note that the Test button tests the last saved version of the screen. You should save the screen before testing it to ensure that testing is accurate. Once you save a screen, changes cannot be undone.

CAPITAL will check the script for obvious syntactical errors, however you will need to run and test the script using "live" data in order to find and correct all errors.

Execution of Formulas

All script formulas that you create are executed every time a record is moved to (displayed).

Individual formulas are also executed if the contents of a field is changed. The execution of the formula script occurs as soon as the user moves to another field.

generate/mistake1.gif Scripts do not automatically change the contents of the field they are placed within. Please note that this behaviour is different from CAPITAL Visual Builder. In order to change the contents of a field you must use either the RETURN statement or the SCRWrite() function.

An example using the stock screen will help explain this. This script formula subtracts the value of Allocated (stock allocated) from Stock_in (physical stock) and updates the field with the specified amount:

Return SCRRead("Stock_in") - SCRRead("Allocated")

You can use the SCRWrite() function to control which field is updated. For example, if this script was placed on a single line:

SCRWrite("Freestock", SCRRead("Stock_in") - SCRRead("Allocated"))

it would update the contents of the user field Freestock with the physical stock value less the allocated stock value.

generate/hint1.gifYou can also process scripts in response to special events such as adding, editing and deleting records. These scripts are stored in a file that matches the name of the CAPITAL screen but has the file extension .MAC.

For more information on this subject consult the topic: Script Programming.



Help Topic Map