We are doing mass update of Text type Media object attachment for multiple objects, Where we have to get the previously stored MO attachment from F00165 table and append it with the latest MO attachment text and while doing this we should also maintain the format of the text.
You can use the C media object APIs to do this. Fetch the current text, allocate a buffer the size of the current text plus the size of the new text. Concat the current and new text into the buffer and then save the MO. I'm not sure how things would look if you have a mix of RTF and HTML.
Thanks for the reply, I have tried this approach but it's giving me plain text in the result.
Although I have passed HTML formatted MO text value to the bsfn. Also I have used GetGenericTextName API to get the previously stored text.
So how I've dealt this kind of stuff before (not same issue you have but close) is to build some tools in the Database.
1. A function A that converts the IMAGE data type to nVarchar(max) - cast(cast(@TXFT as varbinary(max)) as nvarchar(max))
2. Create a Stored Procedure B that converts the concatenated nvarchar(max) back to binary and updates the original F00165
3. Create a view/query Against F00165 that narrows down the data to text for the Object(s) you want to change - use Function A to convert to nvarchar(max)
4. Build a TSQL script with a Fetch Cursor Loop in it that reads the HTML text as a string, appends your new HTML Text, then calls B with the key fields and HTML string
You may need to do some trimming and add some transition HTML between the two pieces.
Rich, I suspect that the jdeSprintf() is internally extracting the plain text from the HTML. Perhaps using jdeStrncat() instead of jdeSprintf() would work fot you, like this: pNewText = (PJSTR) jdeAlloc(COMMON_POOL, ( jdeStrlen(lpDS->szMediaObjectText) + jdeStrlen(pText) + 8) * sizeof(JCHAR),MEM_ZEROINIT );
jdeStrncpy(pNewText, lpDS->szMediaObjectText, DIM(pNewText))
jdeStrncat(pNewText, pText, DIM(pText));