Jump to content

Look for data differences among all fields between two records?


This topic is 3417 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a situation where I have a table with 10 fields and only two records, and I want to compare them and spot any differences. I have written a script that compares the two records by:

 

a) Set ten variables with the contents of the ten fields of record 1.

B) Go to next record.

c) Set ten more variables with the contents of the ten fields of record 2.

d) Compare the twenty variables, a pair at a time (one from record 1, one from record 2) to be alerted when a pair doesn't match.

 

But now I have to do the same thing to a table with 75 fields (and still just two records). I feel as if there may be a better way, as this would take a very long time to set up the way I was doing it. Does not seem efficient at all, and seems like it would easily break. Any input would be appreciated. Thank you.

Link to comment
Share on other sites

Thanks for your comment, Comment, You had a great idea. I've implemented that and works like a charm. Thank you!

#

Set Variable [$fields; Value:FieldNames ( Get ( FileName ) ; "Comparison Layout" )]

Set Variable [$fieldCount; Value:ValueCount ( FieldNames ( Get ( FileName ) ; "Comparison Layout" ) )]

Loop

  Set Variable [$currentField; Value:GetValue ( $fields ; $fieldCount )]

  Go to Records/request/Page [First]

  Set Variable [$value1; Value:GetField ($currentField)]

  Go to Records/request/Page [Next]

  Set Variable [$value2; Value:GetField ($currentField)]

  If [$value1 ≠ $value2]

    Show Custom Dialog ["Inequality"; "FieldName: " & $currentField & " doesn't match. Record 1: " & $value1 & " Record 2: " & $value2]

  End If

  Set Variable [$fieldCount; Value:$fieldCount - 1]

  Exit Loop If [$fieldCount = 0]

End Loop

Link to comment
Share on other sites

This topic is 3417 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.