FieldWBlockSym Function | |
Return a set-get code block for a field, specified as a symbol, in a specified work area.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION FieldWBlockSym(
symFieldname AS SYMBOL,
dwWorkArea AS DWORD
) AS Codeblock
public static Codeblock FieldWBlockSym(
Symbol symFieldname,
uint dwWorkArea
)
Request Example
View SourceParameters
- symFieldname
- Type: Symbol
The name of the field. - dwWorkArea
- Type: DWord
The work area number where the field resides.
Return Value
Type:
Codeblock
A runtime code block (implemented as an object) that, when evaluated, sets (assigns) or gets (retrieves) the value of
symFieldName in the work area designated by
dwWorkArea.
If
symFieldName does not exist in the specified work area, FieldWBlockSym() returns NULL_OBJECT.
Remarks
FieldWBlockSym() builds a code block. When evaluated with the Evaluate() function, the code block first selects the designated dwWorkArea.
If an argument was passed, the code block then assigns the value of the argument to symFieldName.
If no argument was passed, the code block retrieves the value of symFieldName.
The original work area is then reselected before the code block returns control.
Note that the specified field variable does not have to exist when the code block is created but must exist before the code block is executed.
Examples
This example compares FieldWBlockSym() to a code block created using the macro operator. Note that using FieldWBlockSym() avoids the speed and size overhead of the macro operator:
1
2cbSetGet := &("{|SetVal| If(SetVal == NIL, ;
3 1->FName, 1->FName := SetVal)}")
4
5
6
7cbSetGet := FieldWBlockSym(#FName, 1)
See Also