Tuesday, 28 April 2015

Different MO viewer in IE

The inline editor in JDE is nice now, but there are some dangers in activating it that you need to be aware of!

ActiveX

If you are using the traditional ActiveX controls for editing media objects, they look like this:

image

Note that this activeX control is showing an MO that was created in the browser based editor, see the html control characters.  This is an old and clunky control too, I’d avoid it if I were you.

The contents from this look like the following in F00165:

{ \ r t f 1 \ a n s i \ a n s i c p g 1 2 5 2 \ d e f f 0 \ d e f l a n g 1 0 3 3 { \ f o n t t b l { \ f 0 \ f s w i s s \ f p r q 2 \ f c h a r s e t 0   C o u r i e r   N e w ; } } 

{ \ c o l o r t b l ; \ r e d 0 \ g r e e n 0 \ b l u e 0 ; }

\ v i e w k i n d 4 \ u c 1 \ p a r d \ c f 1 \ f 0 \ f s 2 0 j h j \ p a r

\ p a r

n e w l i n e \ p a r

\ p a r

a s d s a d a s d s a d n e x t \ p a r

\ p a r

I d u n n o \ p a r

}

You can see how this is actually written as RTF to the BLOB.  This is rubbish and hard to pull apart.  If you get the choice, avoid it.


Inline editor


It looks WAY cooler – see below.  Also it’s the same on other browsers, which is nice.  I recommend making this your standard.  But, read on!


image


image


When you look into the F00165 gdtxft, you see the following text.  Note that SQL developer is pretty lackadaisical about how it interprets the string.  You think it’s totally RAD and interpreting a unicode string, it’s not.  It’s actually displaying a byte at a time the varchar2 string that is coming back from my fancy f() function to cast the RAW to varchar.


The above is really important when it comes to cowboying.

(CLOB) T h i s   i s   a   m e d i a   O b j e c t . < b r / > 
T h i s   i s   a   n e w   l i n e < b r / > s o   i s   t h i s        

Note also that the formatting is TOTALLY different, it’s html based formatting.  The <br/> etc is part of the text, but not shown in the HTML representation of the string, as it’s HTML.  Awesome.


So, what you see from above is that you really need to choose one method or the other so that the text is formatted nicely.  The problem will be when you come to print this media object text on a report, it’ll have html control characters OR it’ll have all the RTF stuff.


The choice between the two settings is in SM, illustrated below:


image


Change you just insert Media Objects into F00165?


Yes, OLE and file based is easy, text quite a bit harder = but possible.  What you are going to find is that if you finally work out the correct casting / unicode and text conversion functions in your statement, JDE STILL will not show the text up as text, it’ll all be funny characters.  This is because JDE store the code as little endian / big endian.  This is not really strictly exactly the right use, but let me explain.  unicode is AL16UTF16 (well my unicode) represents most characters in 2 (or more) bytes.  Therefore the character H is 0 & 72 (decimal values for the two bytes). The data is stored in the second byte (when dealing with conversions and unicode routines in the DB).  The issue with JDE is that it uses the first byte at the significant digit.


image


See above, if you just do an insert into the F00165 with something like:

insert into testdta.f00165
values (
'ABGT',
'12',
4,
0,
' ',
'HBECK',
115090,
163908,
'AL16UTF16',
' ',
' ',
' ',
' ',
' ',
' ',
0,
0,
utl_i18n.string_to_raw('Hello','AL16UTF16'));

You get “chinese like” characters come up in the APP.  This is because JDE thinks that the first byte is significant, but oracle wrote the second one as significant – DAMN!


If you are a bit nerdy (like me), then there is always a solution.  I wrote a java program that reversed the byte order of the CLOB byte array, therefore converting the oracle based CLOB character significance into something that JDE understands.


What does this mean, well for starters the combination of the java code and the SQL can have you adding media objects that can be read and then written / modified in JDE – nice!  Also, what I learned from doing this means that I’m going to finally write a program that is going to change UBE QUEUEs without checking in or out versions – hack the BLOB in F983051 directly.

No comments:

Extending JDE to generative AI