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>set relation</b> set up a scoped relation http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SET RELATION         Set up a scoped relation
------------------------------------------------------------------------------

Synopsis

    SET RELATION TO <xKey> INTO <cAlias> [SCOPED] [ADDITIVE]

Arguments

    <xKey> is the relational expression.  Any field expressions MUST include
    an alias.

    <cAlias> is the alias of the child workarea.

Description

    SET RELATION TO .. SCOPED is identical to SET RELATION TO, but it sets up
    a scope on the master index of the child workarea at the same time the
    relation is set up.  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.

NOTE: Any field references MUST include an alias (see examples).

Example

    use invoice new                     && Bring invoice database into use
    set order to tag custNo             && Make customer # master index

    use customer new                    && Bring customer database into use

        //  Set a "scoped" relation from customer into invoice
    set relation to customer->custNo into invoice scoped

    go top
    do while !eof()
        ? last, first                   && Get customer header fields

        sele invoice
        list "   ", date, subtotal      && List invoice detail fields
                                        && for all related invoices

        sele customer                   && Onto next customer record
        skip
    enddo

See Also

    cmxSetRelation()


See Also: cmxSetRelation()

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