Functions and commands

achtung

BeasScript is a Interpreted Script Language.

It is Case Sensitive.

Write all commands in lower case.

Insert always only one space between the keywords

 

Lines, Carriage Return

Lines can begin with White Space or Tabs. You can use tab as much as you want.

A Lines ends with Carriage Return.

You can connect several lines into one with "&"

 

Comments

Comments need to be declared with //

 

Variables

beas works with string variables, if you don't declare this. You have access to variables with <variablename> or <object property>

you define a variable with

setvar=variablename=value

This type of variable is always type "string" and visible is instance (window related)

Example:

setvar=ls_myvalue=hello world

messagebox=<ls_myvalue>

 

Add Variable: use addvar or use with place holder

setvar=ls_myvalue=hello

messagebox=<ls_myvalue> world

 

You can define  Variables with instance or local

instance string is_value

local string ls_value

 

Naming:

You should start all you Variables in general with the Namespace of the Company.

e.g.

string beas_myvalue=Hello World

 

You can access a Variables via < and >

e.g.

string ls_beas_myvalue1
string ls_beas_myvalue2
string ls_beas_myvalue3
ls_beas_myvalue=Hello
string ls_beas_myvalue2=World
// The next line will access the variables 
ls_beas_myvalue3=<ls_beas_myvalue1> <ls_beas_myvalue2>!
messagebox=<ls_beas_myvalue3>   

 

 

 

Numbers and Dates / Datetime must be formatted.

For more information please see "Placeholder and Variables"

 

 

Functions

You can create local and global ( means Form wide scope )

If you wish you can create global Functions via BeasScript.

Functions do not have Parameters and they just return one Value:

<return> with failure(-1), success(1) or no_action(0)

Inside the function you will use private Variables. These Variables can be accessed inside a Form, local, global and private functions.

 

Local Functions:

you can create as many Functions as you wish.

Declaration:

function ...

end

 

global Functions:

Global Functions will be declared with

global function

..

end global.

Scope:

The Function will go out of scope when the Form is closing.

 

Naming:

Global Functions should be named with leading namespace of the Company.

e.g.. pia_myfunction()

 

 

if .. end if

BeasScript actually only supports simple if ... end if Commands.

Syntax:

if <value1> = <value2> then
   // commands
end if

 

 

You need to use logical Placeholder Variables to tell the internal Engine that you need different Data types.

Remember !!! Any Variable inside the BeasScript Engine uses the DataType String.

like  n=, n<>, n< bzw. n>

decimal lc_numeric1,lc_numeric2
lc_numeric1=300
lc_numeric2=400.567
if <lc_numeric1,#0.0000> n= <lc_numeric2,#0.0000> then
  // commands
end if

 

for ... next

BeasScript actually supports for ... next and  nested for ... next.  

e.g.

string ls_beas_myvalue
for=li_loop=10=1=-1
   ls_beas_myvalue=<ls_beas_myvalue> (<li_loop>)
next
messagebox=<ls_beas_myvalue>  // Output: (10) (9) ... (1)

You can also use DateFields with the for .. next

 

 

Return Values

return failure
return success
return no_action