Reporting Differences Between Databases This application demonstrates how to prepare a report which lists differences between corresponding records in two databases. Assume there are two databases, MAILING1.DTF and MAILING2.DTF, which both share the following design: Customer #: Name: Address: City: State: Zip: The following report compares address fields from records in MAILING1.DTF and MAILING2.DTF with the same customer number. When Q&A discovers a difference between the two, it prints the customer number and the two addresses. In MAILING2.DTF, move from File to Design to Customize to Speed up searches and enter an "S" in the "Customer #" field. In MAILING1.DTF, go into Design/Redesign a report and enter the following on the Column/Sort spec. Customer #: 1,I,AS Name: Address: 2,I City: State: Zip: Press F-8 to move to the Derived column screen and enter the following: Heading: copy address from MAILING2 Formula: @XLOOKUP("MAILING2", #1, "Customer #","Address") Column Spec: 3,I Heading: Difference for!Customer # Formula: @text( #2<>#3, #1) Column Spec: 4,F(JR) Heading: Address from!MAILING1 Formula: @text( #2<>#3, #2) Column Spec: 5 Heading: Address from!MAILING2 Formula: @text( #2<>#3, #3) Column Spec: 6 Q & A Application Note Rev. 6/92 #2211 Page 1 of 2 Reporting Differences Between Databases The resulting report might look like this: Difference for Address from Address from Customer # MAILING1 MAILING2 -------------- ------------ ------------- 29867 13 Elm St. 191 Maple Ct. 30033 6 Main Blvd. 999 Scenic etc. Note that only records with differences are printed. Q & A Application Note Rev. 6/92 #2211 Page 2 of 2