March 18, 200619 yr 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?
March 18, 200619 yr 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.
March 18, 200619 yr 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.
March 18, 200619 yr Author Newbies I was leaning this route. If I can identify the first character where the two fields become different that would do it.
March 18, 200619 yr 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.
March 18, 200619 yr 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, 200619 yr by Guest
Create an account or sign in to comment