Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Comix 3.0 Reference Manual - <b>cmxsetrelation()</b> set a scoped relation http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
cmxSetRelation()      Set a scoped relation
------------------------------------------------------------------------------

Synopsis

    cmxSetRelation(nArea | cAlias, bKey [, cKey]) -> NIL

Arguments

    nArea or cAlias specifies the child workarea.

    bKey is the code block that specifies the relational expression.

    cKey is an optional expression that specifies the relational expression
    as a character string.

Returns

    NIL

Description

    cmxSetRelation() is identical to dbSetRelation() but it also sets up a
    scope on the master index in the child workarea.  This means that
    whenever you select the child workarea, only the records related to the
    current parent record will be visible.

    This allows straightforward handling of one-to-many relationships, and
    is particularly useful when displaying child TBrowse windows.

Example

    use litems new                      && Bring line item database into use
    set order to tag invNo              && Make invoice # master index

    use invoice new                     && Bring invoice database into use

        //  Set a "scoped" relation from invoice into litems
    cmxSetRelation("litems", { || invoice->invNo }, "invoice->invNo")

    go top
    do while !eof()
        ? invNo, date                   && Get invoice header fields

        sele litems
        list "   ", partNo, qty, price  && List line item detail fields
                                        && for all related line items

        sele invoice                    && Onto next invoice record
        skip
    enddo

See Also

    SET RELATION


See Also: SET RELATION

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson