Navigation:  ABC Library Reference > FieldPairsClass > FieldPairsClass Methods >====== Equal (return 1 if all pairs are equal) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

Equal

blk2blue.jpg

The Equal method returns one (1) if all pairs are equal and returns zero (0) if any pairs are not equal.

Implementation:

The Equal method simply calls the EqualLeftRight method which does all the comparison work. Therefore, there are two different methods (Equal and EqualLeftRight) that produce exactly the same result.

This provides an alternative calling convention for the FieldPairsClass and the BufferedPairsClass. The EqualLeftRight method name is consistent with the other comparison methods in the BufferedPairsClass and is provided for that purpose. See BufferedPairsClass Methods for more information.

Example:

Fields.AddPair(CUST:Name,  CustQ.Name)  !establish Name pair

Fields.AddPair(CUST:Phone, CustQ.Phone) !establish Phone pair

Fields.AddPair(CUST:ZIP,  CustQ.ZIP)    !establish ZIP pair

!some code

IF ~Fields.Equal                        !compare field pairs

 CASE MESSAGE('Abandon Changes?',,,BUTTON:Yes+BUTTON:No)

 OF BUTTON:No

  Fields.AssignRightToLeft       !copy changes to CUST (write) buffer

 OF BUTTON:Yes

  Fields.AssignLeftToRight       !restore original to CustQ (display) buffer

 END

END

See Also:     EqualLeftRight