Click or drag to resize

DataWindow.SetRelation Method (Typed)

X#
Set a relation from the data server connected to this data window to the data server of another, creating an owner-child relationship between the two servers and the two windows.

Namespace:  XSharp.VO.SDK
Assembly:  XSharp.VOGUIClasses (in XSharp.VOGUIClasses.dll) Version: 2.21
Syntax
 VIRTUAL METHOD SetRelation(
	oDWChild AS DataWindow,
	uRelation AS USUAL,
	cRelation AS STRING
) AS USUAL
Request Example View Source

Parameters

oDWChild
Type: DataWindow
The window attached to the child server; which must be a data window linked to a server of compatible type. If omitted, all relations for this server are removed (although the recommended way of doing this is the DataWindow:ClearRelations() method).
uRelation
Type: Usual
The relation code block for the server, The name or symbol representing the field from this server; a code block is constructed and macro-compiled or the array of field names or symbols representing the relation for the server. The field names are concatenated with plus signs and formed into a code block which is macro-compiled.
cRelation
Type: String
When the relation is specified as a code block, a string version of the code block can be provided as well; it is returned by the Relation() method.

Return Value

Type: Usual
TRUE if successful; otherwise, FALSE.
Remarks
Tip Tip
This operation may not be supported, depending on whether the servers used supports relations and are of compatible types. The prototypical implementation is the standard Xbase DBServer:SetRelation() method provided.
Examples
The API can take these forms:
X#
1oDWCustomer:SetRelation(oDWOrders, {||_FIELD->CustNo},"CustNo")
2oDWCustomer:SetRelation(oDWOrders, #CustNo)
3oDWCustomer:SetRelation(oDWOrders, {#LastName,#Initial,#FirstName})
See Also