| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > BufferedPairsClass > BufferedPairsClass Methods >====== AddPair (add a field pair:BufferedPairsClass) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[bufferedpairsclass functional organization expected use.htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[assignbuffertoleft copy from buffer fields to left fields .htm|{{btn_next_n.gif|Next page}}]] | | || **AddPair(**// left, right //**), VIRTUAL** {{blk2blue.jpg|blk2blue.jpg}} | **AddPair** | Adds a field pair to the RealList property. | | //left// | The label of the "left" field of the pair. The field may be any data type, but may not be an array. | | //right// | The label of the "right" field of the pair. The field may be any data type, but may not be an array. | The **AddPair **method adds a field pair to the RealList property. A third "buffer" field is supplied for you. You may use this third "buffer" as an intermediate storage area (a save area). The fields need not be contiguous in memory, nor do they need to be part of a structure. Therefore you can build a virtual structure simply by adding a series of otherwise unrelated fields to a BufferedPairs object. The other BufferedPairs methods then operate on this virtual structure. **Implementation:** AddPair assumes the RealList property has already been created by Init or by some other method. By calling AddPair for a series of fields (for example, the corresponding fields in a RECORD and a QUEUE), you effectively build three virtual structures containing the fields and a (one-to-one-to-one) relationship between the structures. **Example:** ** INCLUDE('ABUTIL.INC')            !declare BufferedPairs Class** **Fields  &BufferedPairsClass       !declare BufferedPairs reference** **Customer FILE,DRIVER('TOPSPEED'),PRE(CUST),CREATE,BINDABLE** **ByNumber  KEY(CUST:CustNo),NOCASE,OPT,PRIMARY** **Record    RECORD,PRE()** **CustNo     LONG** **Name       STRING(30)** **Phone      STRING(20)** **          END** **         END** **CustQ   QUEUE** **CustNo   LONG** **Name     STRING(30)** **Phone    STRING(20)** **        END** ** CODE** ** Fields &= NEW BufferedPairsClass       !instantiate BufferedPairs object** ** Fields.Init                            !initialize BufferedPairs object** ** Fields.AddPair(CUST:CustNo, CustQ.CustNo)!establish CustNo pair** ** Fields.AddPair(CUST:Name,  CustQ.Name)   !establish Name pair** ** Fields.AddPair(CUST:Phone, CustQ.Phone)  !establish Phone pair** **See Also:**     [[init initialize the bufferedpairsclass object .htm|Init]], [[reallist recognized field pairs .htm|RealList]]