Click or drag to resize

SetFieldStore Function (Logic)

X#
Return and optionally change the setting that determines whether assignments are made to fields or to memory variables.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION SetFieldStore(
	lNewSetting AS LOGIC
) AS LOGIC
Request Example View Source

Parameters

lNewSetting
Type: Logic
TRUE turns field assignment on; FALSE turns it off.
The initial default is FALSE.

Return Value

Type: Logic
If lNewSetting is not specified, SetFieldStore() returns the current setting.
If lNewSetting is specified, the previous setting is returned.
Remarks
If there are PRIVATE or PUBLIC variables that have the same name as a database field in the current work area, assignments are made to the memory variables (PRIVATE, PUBLIC) unless SetFieldStore() is set to TRUE.
Examples
This example shows the effect of SetFieldStore() on a private variable:
X#
 1PRIVATE LName
 2LName := "MyMemVar"
 3USE Test
 4? Test->LName                    // OldField
 5// This refers to the PRIVATE variable called LName:
 6? LName                        // MyMemVar
 7// Default setting is FALSE
 8? SetFieldStore()                // FALSE
 9// Since SetFieldStore() is FALSE, this will
10// assign a value to the PRIVATE memory variable called LName
11LName := "NewVal"
12? Test->LName                    // OldField
13? LName                        // NewVal
14? SetFieldStore(TRUE)
15    // FALSE (returns previous setting)
16// Since SetFieldStore() is TRUE, this will
17// assign a value to the database field called LName
18LName := "NewestVal"
19? Test->LName                    // NewestVal
20// This still refers to the PRIVATE variable called LName:
21? LName                        // NewVal
See Also