Navigation:  Classes > bArrayServer >

bArrayServer:SetSelectiveRelation()

Print this Topic    Previous pageReturn to chapter overviewNext page

Purpose

Set a selective relation from this server to the child server.

Class

bArrayServer

Type

Method

Syntax

<oArrayServer>:SetSelectiveRelation(

<oChild>,;

<cbRelation>,;

<cRelation>,;

[<lAutoClose>]

) Æ lSuccess

 

<oArrayServer>:SetSelectiveRelation(

<oChild>,;

<cField> | <symField>,;

[<lAutoClose>]

) Æ lSuccess

 

<oArrayServer>:SetSelectiveRelation(

<oChild>,;

<acField> | <asymField>,;

[<lAutoClose>]

) Æ lSuccess

Arguments

<oChild>The child server to that the selective relation is to be set.
Data type:DataServer

 

<cbRelation>The code block with that the selective relation between this server and the child server is to be set.
Data type:Codeblock | _Codeblock-Object

 

<cRelation>The expression as string for which the selective relation 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 selective 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

 

<symField>The field name as symbol for which the selective 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 selective 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>An array of field names as symbols for which the selective 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 selective relation was set.
TRUEThe selective relation was set.
FALSE The selective relation could not be set.
Data type:Logic

Description

bArrayServer:SetSelectiveRelation() links this server with a child server. Operations in the child server are restricted to those records that match the relation. In the child server an index must be active whose index expression corresponds to the expression of the selective 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 selective relation with this server. The record pointer in the child server is moved automatically whenever the record pointer in this server is changed.

Samples

The following example sets a selective relation between the two bArrayServer <oasCUSTOMER> and <oasINVOICE>. The bArrayServer <oasCUSTOMER> contains customer data. The bArrayServer <oasINVOICE> contains invoice data for the customers. After the relation was set to the bArrayServer <oasINVOICE>, this server contains only those records that related to the current customer in the bArrayServer <oasCUSTOMER>.

 

// create bArrayServer with customer

auStruct := {;

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

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

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

                       }

 

auData := {;

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

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

                       }

 

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

 

// create bArrayServer with invoices

auStruct := {;

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

                               {"FDATE", "D", 8, 0},;

                               {"INVOICEID", "N", 5, 0},;

                               {"TOTAL", "N", 8, 2};

                       }

 

auData := {;

                               {"00001", 03/12/01, 12, 253.12},;

                               {"00007", 05/24/01, 13, 79.84},;

                               {"00001", 06/13/02, 14, 176.99},;

                               {"00001", 08/06/02, 15, 39,63};

                       }

 

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

oasZIP:CreateOrder("Server:ID")

 

// sets relation between customer and invoices

oasCUSTOMER:SetSelectiveRelation(oasINVOICE, , "Server:ID", TRUE)

See Also

bArrayServer:Children

bArrayServer:ClearRelation()

bArrayServer:Relation()

bArrayServer:SetRelation()

 


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