Newbies jaster Posted March 18, 2006 Newbies Posted March 18, 2006 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?
Kent Searight Posted March 18, 2006 Posted March 18, 2006 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.
comment Posted March 18, 2006 Posted March 18, 2006 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.
Newbies jaster Posted March 18, 2006 Author Newbies Posted March 18, 2006 I was leaning this route. If I can identify the first character where the two fields become different that would do it.
Kent Searight Posted March 18, 2006 Posted March 18, 2006 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.
comment Posted March 18, 2006 Posted March 18, 2006 (edited) 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 March 18, 2006 by Guest
Newbies jaster Posted March 21, 2006 Author Newbies Posted March 21, 2006 Thanks, that works perfectly. Just what I needed.
Recommended Posts
This topic is 7170 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 accountSign in
Already have an account? Sign in here.
Sign In Now