I have a system that needs to compare the before and after values of a bunch of fields. There is a calc field, cFieldValues, that strings together the important fields and separates each value by a delimiter character and carriage return. When the user clicks the button to enter the edit mode screen, the button script puts cFieldValues into a global gStartValues. When the user saves the record, the button script has an IF statement that compares the current cFieldValues to the global with a simple "=" operator. If there are changes to any field values, other stuff needs to happen.
This seemed like a sure thing until I began to see records with more than 255 characters in the cFieldValues calc result. For the 256th character and above, the "=" operator does not detect inequalities if characters are changed but the total number of characters stays the same. For example, if the string does not change for 255 characters but at the 256th character "one" gets changed to "two", then the comparison sees the before and after strings as the same. If "one" gets changed to "three", then the comparison sees the strings as different.
I couldn't find any documentation regarding the limit to the size of strings that the "=" operator could work with.
To fix the problem I am using the PatternCount function to compare the before and after values:
If (PatternCount (cFieldValues, gStartValues) + PatternCount (gStartValues, cFieldValues) <> 2, "Different", "Same")
The PatternCount function seems more robust. If anyone has any comments, I'd love to hear.
Bye! -- Mark