Synergex.SynergyDE.Select.JoinSelect

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
namespace Synergex.SynergyDE.Select
public sealed class JoinSelect

The JoinSelect class object is required when using Joins. The Join() method in the Select class converts a Select object into a JoinSelect object. (Note that a Join operation must be included somewhere in the Select.)

Methods

GetEnumerator

public GetEnumerator(), @RowEnumerator

Creates and returns a RowEnumerator object. See Synergex.SynergyDE.Select.RowEnumerator.

GetRowArrayIndex

public GetRowArrayIndex(record), n

Returns the index of the specified record (a) in any Rows object created by that RowEnumerator. This index remains static throughout the life of the JoinSelect object. Using GetRowArrayIndex() along with the indexer is an alternative to using the Rows.Fill() method. If the specified rec passed to GetRowArrayIndex() does not exactly match a record specified in the Join, an INVARG error (“Invalid argument”) is generated.

Discussion

No record updates or deletes are available via the JoinSelect object.

The Select becomes a JoinSelect when the Join() method is applied to the Select object. The on parameter is part of the From.InnerJoin() or From.LeftJoin() method.

In the following example, the JoinSelect object starts out like a Select but includes Join(). If there is no InnerJoin() or LeftJoin(), an INVOPER error (“JoinSelect requires one or more From.InnerJoin or From.LeftJoin specifications”) is generated.

joinObj = new Select( fromOrders.InnerJoin( fromOrderdetails, 
&         (On)(order.OrderID == orderdetail.OrderID) ) ).Join()

See also

Joining data from multiple sources

Examples

import Synergex.SynergyDE.Select
record categories
    CategoryID    ,d5
    CategoryName  ,a20
    Description   ,a100

record products
    ProductID     ,d5
    ProductName   ,a50
    SupplierID    ,d5
    CategoryID    ,d5
    Unit          ,a20
    Price         ,d5.2

record
    jobj          ,@JoinSelect
    rowobj        ,@Rows
...
    jobj = new Select(new From(1, categories)
  &        .InnerJoin(new From(2, products),
  &        (On)(categories.CategoryID == products.CategoryID))).Join()
    foreach rowobj in jobj
begin
    rowobj.fill(categories)  ;Fill categories record
    rowobj.fill(products)    ;Fill products record
    writes(TTCHN, %string(ProductID) + "  " + ProductName + " " +
  &        CategoryName + " " + %string(categories.CategoryID))
end