Navigation:  Classes >

bCodeblock

Print this Topic    Previous pageReturn to chapter overviewNext page

Purpose

Defines a code block capable of storing its runtime creation parameters and also offering access to its source code.

Class

bCodeBlock

Properties

ArgumentList(Access / Assign)
ArgumentValues(Access / Assign)
Block(Access)
ErrorNo(Access)
Expression(Access / Assign)
Server(Access)

Methods

Compile()

Eval()

GetArgumentPos()

Init()

IsCompiled()

IsValid()

Use()

Internal Methods

CreateCodeblock

Inherits From

<No ancestor>

Inherited By

<No descendants>

Description

Class bCodeblock makes possible the compilation and execution of variable source code at runtime. The class works similarly to the _Codeblock class of Visual Objects. Unlike this, bCodeblock offers an access to the source code. Further, the arguments which should be passed to the code block when executing can be defined in the class.

Samples

The following sample creates, compile and evaluate an object of class bCodeblock:

 

LOCAL odbsCUSTOMER   AS DBServer

LOCAL oCodeblock     AS bCodeblock

 

// Create DBServer

odbsCUSTOMER := DBServer{"CUSTOMER"}

 

// Create bCodeblock

oCodeblock := bCodeblock{"Server:LASTNAME + Server:FIRSTNAME",;

                         odbsCUSTOMER}

 

// Compile source code

IF oCodeblock:Compile()

   // Evaluate source code

   ? oCodeblock:Eval()

ENDIF

 

The following sample creates an object of class bCodeblock and changes the source code afterwards.

 

LOCAL odbsCUSTOMER   AS DBServer

LOCAL oCodeblock     AS bCodeblock

 

// Create DBServer

odbsCUSTOMER := DBServer{"CUSTOMER"}

 

// Create bCodeblock

oCodeblock := bCodeblock{odbsCUSTOMER}

 

// Change source code

oCodeblock:Expression := "Server:LASTNAME + Server:FIRSTNAME"

 

// Compile source code

IF oCodeblock:Compile()

   // Evaluate source code

   ? oCodeblock:Eval()

ENDIF

 


Page url: http://www.YOURSERVER.com/index.html?bcodeblock.htm