Navigation:  Classes > bArrayServer >

bArrayServer:SetRelation()

Print this Topic    Previous pageReturn to chapter overviewNext page

Purpose

Set a relation from this server to a child server.

Class

bArrayServer

Type

Method

Syntax

<oArrayServer>:SetRelation(

<oChild>,;

<cbRelation>,;

<cRelation>,;

[<lAutoClose>]

) Æ lSuccess

 

<oArrayServer>:SetRelation(

<oChild>,;

<cField> | <symField>,;

[<lAutoClose>]

) Æ lSuccess

 

<oArrayServer>:SetRelation(

<oChild>,;

<acField> | <asymField>,;

[<lAutoClose>]

) Æ lSuccess

Arguments

<oChild>The child server for the relation to be set.
Data Type:DataServer

 

<cbRelation>The code block describing the relation to be set between this server and the child server.
Data Type:Codeblock | _Codeblock-Object

 

<cRelation>The relation expression as string between this server and the child server is to be set. If the argument <cbRelation> is not indicated, the string is converted into a _Codeblock statement as follows:

 

&("{|Server| "+cRelation+"}")

 

Data Type:String

 

<cField>The field name as string for which the relation between this server and the child server is to be set. The field name is converted into a _Codeblock object. The field name must be defined both in this and in the child server.
Data Type:String

 

<symField>The field name as symbol for which the relation between this server and the child server is to be set. The field name is converted into a _Codeblock object. The field name must be defined both in this and the child server.
Data Type:String

 

<acField>An array of field names as strings for which the relation between this server and the child server is to be set. The field names are converted into a _Codeblock object. The field names must be defined both in this and the child server.
Data Type:Array

 

<asymField>The array of field names as symbols for which the relation between this server and the child server is to be set. The field names are converted into a _Codeblock object. The field names must be defined both in this and the child server.
Data Type:Array

 

<lAutoClose>A logical value that defines whether the child server is to be closed automatically if this server is to be closed. If this argument is not specified, as default the value FALSE is used.
Data Type:Logic

Return Value

lSuccessA logical value that indicates whether the relation was set.
TRUEThe relation was set.
FALSEThe relation could not be set.
Data Type:Logic

Description

bArrayServer:SetRelation() links this server with a child server. In the child server an index must be active whose index expression corresponds to the expression of the relation.

 

Before the operation a NotifyIntentToMove message is sent to the child server. After successful execution a NotifyRelationChange message is sent to the child server.

 

The child server is synchronized by a relation with this server, by moving the record pointer automatically in the child server as soon as the record pointer in this server is changed.

Samples

The following example sets a relation between the two bArrayServer <oasCUSTOMER> and <oasZIP>. The bArrayServer <oasCUSTOMER> contains customer data. The bArrayServer <oasZIP> contains city data to postal zip codes. After the relation was set to the bArrayServer <oasZIP>, this server is always positioned on the related postal zip code of the current customer.

 

// create bArrayServer with customer

auStruct := {;

                         {"ID", "C", 5, 0},;

                         {"LASTNAME", "C", 20, 0},;

                         {"FIRSTNAME", "C", 15, 0},;

                         {"ZIPCODE", "C", 5, 0};

                 }

 

auData := {;

                         {"00001", "Schmidt", "Harald", "11501"},;

                         {"00007", "Bond",    "James",  "83617"};

                 }

 

oasCUSTOMER := bArrayServer{auStruct, auData, BINACTIVE, BDATAFORMAT_DBASE}

 

// create bArrayServer with zip codes

auStruct := {;

                         {"ZIP", "C", 5, 0},;

                         {"CITY",  "C", 20, 0},;

                         {"STATE", "C", 2, 0};

                 }

 

auData := {;

                         {"82345", "Dallas", "TX"},;

                         {"11501", "New York", "NY"},;

                         {"87636", "Kansas City", "KS"},;

                         {"83617", "Chicago", "IL"};

                 }

 

oasZIP := bArrayServer{auStruct, auData, BINACTIVE, BDATAFORMAT_DBASE}

oasZIP:CreateOrder("Server:ZIP")

 

// set relation between customer and zip codes

oasCUSTOMER:SetRelation(oasZIP, , "Server:ZIPCODE", TRUE)

See Also

bArrayServer:Children

bArrayServer:ClearRelation()

bArrayServer:Relation()

bArrayServer:SetSelectiveRelation()

 


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