Appending new lines of text to a text field with JAVA

I’m developing a J2EE front end to a purchased third party application. I’m using WAS 5.0 with Domino 6.0.2 running DIIOP. I’ve enabled SSO for authentication. Everything was going great until I tried to append text to an existing field in the document.

Appending text to a field (computed) with JAVA using;

Item i = doc.replaceItemValue(“updateHistory”, sep + append + doc.getItemValueString(“updateHistory”));

flattens the updateHistory field on the document. (i.e. the text is appended but all new lines \n and carriage returns \r seem to have been removed.)

If I edit the document in the Notes client this field is formatted properly again. Looking at the document in question I can see that NotesPeek sees the line feeds as \0 in the updated document like all others.

I know there are a couple of other posts that mention this but none that offer any ideas that are available to us. (http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/4719f0208ab45f4f85256e44005e3a81?OpenDocument) Making changes to the template isn’t an option.

As an aside to this, I’ve tried several methods in my code that aren’t enabled to work for remote calls and sessions. However, there is no mention of this in the documentation. One example is;

doc.replaceItemValueCustomDataBytes(“updateHistory”, “Text List”, b);

I hate chasing an idea to find out the hard way that it won’t work. I wouldn’t have bothered to try this if the documentation was complete in stating that this method doesn’t work over remote calls. I don’t think that’s too much to ask.

Sorry for the winded post. Just really frustrated with this. Any ideas, and I mean any ideas, would be appreciated.

Regards,

Jon LeDrew

Subject: Appending new lines of text to a text field with JAVA.

Maybe you have already seen this, or maybe it doesn’t help – I can’t now remember what the “further bug” was.

Subject: Appending new lines of text to a text field with JAVA.

In addition to what Andre posted, I think this might help:

The settings “Separate values when user enters” and “Display multiple values using” only apply to the UI widget on the Notes form. They are used when translating the input UI text to stored field content and vice-versa. If you are not using the Notes UI (or the Domino-created HTML UI), then you are not creating multiple values when you use the specified separator.

Subject: RE: Appending new lines of text to a text field with JAVA.

This is not a text field; it’s a text list field – multivalued.

You talk about appending a value, but looking at your code it appears you’re actually prepending. If you were really appending you could use appendItemValue method. As it is, it appears you had better use getItemValue to get the Vector of current values, adjust the contents of that (add an element, shift all strings one element higher, and put the new value in the first element). Then use replaceItemValue to put the new value into the field.

Subject: RE: Appending new lines of text to a text field with JAVA.

I’ve never understood the use of “prepending”… why prepend when there’s already a perfectly acceptable prefix out there?

;o)

Subject: RE: Appending new lines of text to a text field with JAVA.

“Prepend”? There’s no such word in my Oxford or Webster’s dictionaries. “Append” does not specify where the extra part goes, though it rhyhmes with “end” and I suppose this is enough to make some people think otherwise. So yes, “prefix” and “suffix” are better.

Subject: Or find a new dictionary

see http://dictionary.reference.com/search?q=prepend or http://info.astrian.net/jargon/terms/p/prepend.html or http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?prepend

Also note that when searching Google for ‘prepend’, there are 157,000 results, so I think it has reached a certain level of acceptance, at least in the computer world. It is even used as a method in the XmlAttributeCollection class in .Net:

Subject: RE: Appending new lines of text to a text field with JAVA.

No it is a text field. Not multi-valued. It’s one long string. (Not my design)

You are right I am prepending. appendItemValue doesn’t work either.

I think I mentioned in my original post that I can’t change the field type from text to text list.

Thanks for the response. In the meantime I have broken and changed the applications computed for display field to remove Char(13) and Char (10). It displays properly now. Just not the solution I was looking for.

Regards,

Jon