Author Topic: Data migration - t_document rtf format  (Read 1495 times)

Luigi2021

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Data migration - t_document rtf format
« on: September 22, 2021, 09:52:45 pm »
Hi,

I am working on a little tool that can migrate old data from our old custom system's databse into EA 15.2 (Postgres Database). Everything works fine except that I have problem inserts and updates on the t_document table. In my migration application I created a function that saves the content of the "bincontent" field as a zipfile(which it is AFAK). When I unzip this file there is a file inside called "str.dat". When I open this file in Notepad it looks like a rtf file and when I open it in Wordpad the content looks the same as in EA. So far so good.
When I modify this "str.dat", zip it and use it to update the "bitcontent" field of the original record and open the document in EA, EA prompts with the "New linked document from template" dialog. The first test I did was with a rtf created in Wordpad. That didn't work. So I though it might be a rtf version issue so I tested it with EA's format with just a small modification but the "New linked document from template" dialog still appeared when I tried to open the document in EA.

Any suggestions how I can make this work?

Thanks in advance,

Luigi

qwerty

  • EA Guru
  • *****
  • Posts: 12335
  • Karma: +347/-287
  • I'm no guru at all
    • View Profile
Re: Data migration - t_document rtf format
« Reply #1 on: September 23, 2021, 02:00:08 am »
I would guess that EA's RTF is not like any other RTF. Try changing things only slightly (that is alter only some text first and style only later). Will keep you busy for some time. Good luck.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11251
  • Karma: +415/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Data migration - t_document rtf format
« Reply #2 on: September 23, 2021, 04:07:06 pm »
My guess is that your zip algorithm is slightly different from EA's zip, causing it to not recognize the contents.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 7950
  • Karma: +208/-127
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Data migration - t_document rtf format
« Reply #3 on: September 23, 2021, 04:23:06 pm »
Ciao Luigi,

In many circumstances, EA stores larger files (in columns) as Bin64 encoded Zip files (for example with Shapescripts in a profile  _image attribute) with str.dat as the content file.
We have had success in manipulating text to encoded field value (and vice versa) that allows us to make bulk changes to exported Shapescripts and then re-import them.  In the development process, we used file comparators to confirm that what we were exporting was what we were importing within the process steps.  i.e that our str.dat was the same as EA's str.dat.

I would recommend using such comparator tools to determine where in your process you are injecting the anomaly.  That way, you can determine if Geert's suggestion is correct or qwerty's or something else entirely!

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 12335
  • Karma: +347/-287
  • I'm no guru at all
    • View Profile
Re: Data migration - t_document rtf format
« Reply #4 on: September 23, 2021, 05:29:35 pm »
Nope, Paolo. The base64 is what EA presents you from SQLQuery since it returns XML. The DB stores the blob as it is.

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 7950
  • Karma: +208/-127
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Data migration - t_document rtf format
« Reply #5 on: September 23, 2021, 08:27:31 pm »
Nope, Paolo. The base64 is what EA presents you from SQLQuery since it returns XML. The DB stores the blob as it is.

q.
Since I don't have any such documents in our repository, couldn't check.  Live and learn.

Thanks for the clarification,q
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!