Jump to content

find differences if Exact function fails


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

Recommended Posts

  • Newbies

I have a database where I use the exact function to compare text field A to text field B to alert me when they no longer match. I then need to find what the change was. Typically the data in the field is so small that visually finding what is different is very simple. Lately this has not been the case and am now looking for a way to highligh/identify or in some way display what text doesn't match between the two fields.

Does anyone have any ideas or know of a custom function to solve this?

Link to comment
Share on other sites

When you say:

... am now looking for a way to highligh/identify or in some way display what text doesn't match between the two fields.

...do you mean that you just want to show which field changed most recently and display what the change was?

An audit log might work well for this.

Link to comment
Share on other sites

It would be relatively easy to find the FIRST changed character and hilite either the character or the rest of the text - using a custom function.

I believe it would be incredibly complex to find where the change ends and the text reverts to the original.

Link to comment
Share on other sites

What would a typical change look like in one field and how would it compare to the other? If the field values always have a fixed number of words or always have values from a list or if some other rule is followed, that could make it relatively easy.

Link to comment
Share on other sites

Try this custom function:

HiliteDifference ( original ; duplicate )

Let ( [

origChar = Left ( original ; 1 ) ;

dupChar = Left ( duplicate ; 1 ) ;

pass = Exact ( origChar ; dupChar ) ;

nextOrig = Right ( original ; Length ( original ) - 1 ) ;

nextDup = Right ( duplicate ; Length ( duplicate ) - 1 ) ;

hilite = Case ( Length ( nextOrig ) ≥ Length ( nextDup ) ; origChar & nextOrig ; dupChar & nextDup )

] ;

Case (

pass and Length ( nextOrig ) ;

origChar & HiliteDifference ( nextOrig ; nextDup ) ;

TextColor ( hilite ; RGB ( 230 ; 0 ; 0 ) )

)

)

Note that using TextColor() may fail if for example the difference is a space character at the very end. You might consider using the (free) 24U SimpleHighlight plug-in instead.

---

BTW, just overlaying the two fields one on top of another might be simpler - and a lot faster...

Edited by Guest
Link to comment
Share on other sites

This topic is 5729 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
 Share

×
×
  • Create New...

Important Information

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