02-10-2014 01:17 AM - edited 02-10-2014 01:33 AM
Haven't tested with other versions - Extracting data from an external datasource converted to string and appending to a notes field or a UDF with text data type. I've noticed that I'm missing data where the character set / byte is zero or null (or byte = 0 or null) in a given string...So if I have over 200 characters in a a string and I set record.notes or or record.setuserfield(udf,stringvalue); the result in TRIM only contains values prior to byte value of 0.
Below is my workaround to resolve in 7.34...could be incorrect coding on my part. Below is my workaround. Has anyone experienced similar issues.
public override string ToString()
StringBuilder sb = new StringBuilder();
for (int i = 0; i < data.Length; i++)
char c = data[i];
byte b = (byte)c;
if (b == 0)
_Log.Debug("Char " + c + " Byte " + b);
_trimrecord.Notes = sb.ToString();
Solved! Go to Solution.
02-10-2014 04:12 AM
02-10-2014 07:55 AM
It could be because it's a Monday morning here, but I'm not sure I follow. Are you asking why the notes are blanked out when you save a 0 byte / null string to the notes field? If you're an admin and can overwrite notes, that would be the appropriate method. Otherwise use the "AppendNotes" method to ensure you're always adding to notes (instead of possible overwriting).
02-10-2014 02:15 PM
TRIM permissions are correct. if i try appending or overwriting the notes field or a user defined field where the data type is Text and a zero byte value exists somewhere in the string value; when I save - TRIM only saves the characters in the string value before the occurrance of the zero btye character.
02-11-2014 06:52 AM - edited 02-11-2014 06:55 AM
A \0 (null character) always used to be a string terminator when I was coding C in ASCII. These days it's all C# and Unicode so don't see it much any more. I think it is not unreasonable to go through your input and replace any null with (for example) a space before passing it - as far as I can see you will have to do this as an array rather than using string manipulation (as you are doing) otherwise it will also fail. I am guessing your Dataset is not running in Unicode either - but your problem is before you even look at that......
02-12-2014 07:09 AM - edited 02-12-2014 07:10 AM
Thanks Mate. Did not think about splitting string to an array using /0 as a delimiter - rather then looping through each character in the string. But I still think there is an anomaly with trim stripping out data post /0 character. An error should be raised at the very least on verify?.
02-13-2014 05:57 AM
Don't think you can validate and check it is missing - try using string functionality in your programming language and almost certainly you will find that is what is stripping out the post-null part of the string - it's not TRIM/RM that is doing it.