Inserting Media Object Text

DJH

Active Member
Hi list

Anyone know how to convert from Text to Blob via the Event Rules?

I have a load of text which I have brought into a temp E1 table from excel and I need to create a media object record in the F00165 for each one. I cant find a way to convert the text so it will go into the TXFT field in the f00165 table.

Any ideas would be appreciated,

Many thanks

E810 Intel, SQL2000, 8.96.1.2
 
I have done some work with attachments in JDE in the CSMS module and if you wish to add text in there, typically it is all saved in RTF format. You would need the following in your string to insert.
1st - you need an RTF Header like the following:
String newText = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fswiss\\fprq2\\fcharset0 Arial;}}\n{\\colortbl ;\\red0\\green0\\blue0;}\n\\viewkind4\\uc1\\pard\\cf1\\f0\\fs24 "
2nd - you need to insert your text. Keep in mind every line break needs a carriage return, then line break then the \par rtf line break with a space ( '\r'+'\n'+"\\par ") so it could look like the following:
newText = newText + "Here is line 1 of text.\r\n\\par Here is line 2 of text.\r\n\\par \r\n\\par Here is line4 of text."
3rd you need the end of RTF string added on which is close to the end of line( '\r'+'\n'+"\\par }"'\r'+'\n') or ("\r\n\\par }\r\n")
newText = newText + "\r\n\\par }\r\n"
Then you can insert that string in the F00165 - How is up to you, we wrote a c function that isnt perfect but works for our case. we can append upto 2048 chars in the F00165 by calling it.

This alone should work and when you view it in JDE then save it, it will add a few other charecters. Im not sure how these characters work exactly but it adds something like : 2 carrots "^^" then the 01 ascii code (SOH - Start of Heading, in java would be the character '\u0001') then 19 more carrots "^^^^^^^^^^^^^^^^^^^" then then word "Text" then 33 more carrots "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"

you could probably just add this as the last piece of your string before inserting it so
newText = newText + "^^"+'\u0001'+"^^^^^^^^^^^^^^^^^^^Text^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
So to the best of my knowledge if you inserted all this it should work 100%.

also keep in mind F00165.GDTXTL = 168 + lenght of the content
 
Please look at our "One Attachment Manager" solution - it offers native JDE BSFN's for MO manipulation.
 
You can't do it with NER. There is a C API, however, which is VERY simple and looks like this:



<font class="small">Code:</font><hr /><pre> idJDEDBReturn = ModifyGenericTextName ((LPSTR)"GT55005",(LPVOID)&dsKey55005,(LPSTR)szMediaObject); </pre><hr />

You can see an easy implementation in source BD3N0004.c function dcLINKAddAnalysisMediaObjectText (smallest one I could find quickly).


It's very simple to use, supply the Media Object name, fill the key structure, and pass a string. Bang. . .instant cake.
 
If the content is only plain text then there are standard functions available to insert text in media object. Why to take so much of edit pain and you can easily retrive them.

Thanks,
Chan
 
Thanks guys,

Managed to do it in the end using B0500047, ConvertNarrativeText. Once I had created a Media Object entry I just SQL'd the bits I needed changing.
 
Back
Top