Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- SIx Driver RDD v3.00 - Reference Guide - <b>m6_filtjoin():</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  m6_FiltJoin():

  Purpose:  Join two filters with respect to a UNION (.OR.),
            INTERSECT (.AND.), or DIFFERENCE ( .XOR. ).

   Syntax:  m6_FiltJoin( <nHandle1>, <nHandle2>, <nJoinType> )

    Where:  <nHandle1>     --  Is any valid handle to a filter.

            <nHandle2>     --  Is any valid handle to a filter.  If
                               owned by user this filter will be
                               automatically freed.

            <nJoinType>    --  Type of join to execute.  Use the following
                               constants defined in MachSIx.ch to specify
                               what type of join to execute.

                               #define JOIN_UNION        1
                               #define JOIN_INTERSECT    2
                               #define JOIN_DIFFERENCE   3

  Returns:  Logical value:  .T. means the operation was successful,  .F.
            indicates it failed.  In the case of a .F. value call m6_Error()
            to retrieve the reason for the error.

     Note:  This function joins the filter specified by <nHandle2> into
            <nHandle1>.  If <nHandle2> is owned by the user then this filter
            is freed from memory.  If you would like to retain the current
            state of <nHandle1> prior to the join, make a copy of it with
            m6_FiltCopy().

  Example:

         #include "SIXCDX.CH"
         #include "MACHSIX.CH"

         PRIVATE nHandle1, nHandle2

         //..............................................use customer file
         USE Customer via "SIXCDX"

         // In this example we'll demonstrate joining two filters with
         // respect to a UNION.  Filter1 is the record set { 5, 10 }.
         // Filter2 is the record set { 5, 15 }.  The result of the
         // UNION will be the record set { 5, 10, 15 }.

         //..........call function below, to create two filters to join
         InitFilters()

         //......................join filters ( note filter2 will be freed )
         m6_FiltJoin( nHandle1, nHandle2, JOIN_UNION )

         //.......................................display records in filter
         ? m6_FiltTop( nHandle1 )         //  5
         ? m6_FiltSkip( nHandle1 )        // 10
         ? m6_FiltSkip( nHandle1 )        // 15
         ? m6_FiltSkip( nHandle1 )        //  0

         //...........free filter1.  filter2 was freed in the join operation
         ? m6_FreeFilter( nHandle1 )      // .T.

         //.......................................Reset the example filters
         InitFilters()

         // Next we'll demonstrate an INTERSECT of the two filters.  The
         // result will be the record set { 5 }

         //......................join filters ( note filter2 will be freed )
         m6_FiltJoin( nHandle1, nHandle2, JOIN_INTERSECT )

         //.......................................display records in filter
         ? m6_FiltTop( nHandle1 )         //  5
         ? m6_FiltSkip( nHandle1 )        //  0

         //...........free filter1.  filter2 was freed in the join operation
         ? m6_FreeFilter( nHandle1 )      // .T.

         //.......................................Reset the example filters
         InitFilters()

         // Finally we'll demonstrate the DIFFERENCE between the two filters.
         // The result will be the record set { 10, 15 }.

         //......................join filters ( note filter2 will be freed )
         m6_FiltJoin( nHandle1, nHandle2, JOIN_DIFFERENCE )

         //.......................................display records in filter
         ? m6_FiltTop( nHandle1 )         //  10
         ? m6_FiltSkip( nHandle1 )        //  15
         ? m6_FiltSkip( nHandle1 )        //  0

         //...............free filter1.  filter2 freed in the join operation
         ? m6_FreeFilter( nHandle1 )      // .T.

         /*
         *..InitFilters() -- Initialize example filters
         */
         Function InitFilters()

            //............................................create RYO filter1
            nHandle1 := m6_NewFilter()

            //............................................create RYO filter2
            nHandle2 := m6_NewFilter()

            //........................................add records to filter1
            ? m6_FiltAddRec( nHandle1,  5 )  // .T.
            ? m6_FiltAddRec( nHandle1, 10 )  // .T.

            //........................................add records to filter2
            ? m6_FiltAddRec( nHandle2,  5 )  // .T.
            ? m6_FiltAddRec( nHandle2, 15 )  // .T.

         Return ( NIL )


See Also: m6_FiltInverse() m6_NewFilter()

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