Options

EXPORTOBJECTS / Object."Blob Reference".EXPORT

tiagoveigatiagoveiga Member Posts: 10
Hi all,

Version: NAV2009 R2.
Issue: Export "Blob Reference" to Text File from a new table "Object Version".

I've started working in a project where a new Table "Object Version" is used to Store a Backup/Version from the changed objects.
The table is similar to Table "Object" but with a new field "Version No.", this field is also in the primary key.

Currently when there is a need to Export an Older version we've to Modify the Table Object to "restore" the previous version, and Use the EXPORTOBJECTS function.

This is not working 100%, per example if we Export a Report that list Table 50000, the fields listed in the Report will be from the current version of the Table 50000 and not at the time of the Backup.

Example how is done currently:

ObjectVersion.GET(....);
ObjectVersion.CALCFIELDS("Blob Reference")
ObjectVersion."Blob Reference".EXPORT(FileName).
Object.GET(.....);
Object."Blob Reference" := ObjectVersion."Blob Reference";
Object.MODIFY;
EXPORTOBJECTS(FileName,Object,0);

//Then restore the Object."Blob Reference"
This is working, but not 100% correct in some cases.


I want to do something similar but whithout using the table Object.
1.
ObjectVersion.GET(....);
ObjectVersion.CALCFIELDS("Blob Reference")
ObjectVersion."Blob Reference".EXPORT(FileName).

No Success in this, this will not export in Text Format.

2.
ObjectVersion.GET(....);
ObjectVersion.CALCFIELDS("Blob Reference")
ObjectVersion."Blob Reference".CREATEINSTREAM(InStr);
File.CREATE(FileName);
File.WRITEMODE(TRUE);
File.TEXTMODE(TRUE);
FILE.CREATEOUTSTREAM(OutStr);
COPYSTREAM(OutStr,InStr);
FILE.CLOSE

No Success in this, this will not export in Text Format.

I see there are some tools to "read" the documentation
http://www.mibuso.com/dlinfo.asp?FileID=1544

Is there any other tool/way to read/Export in Text file?

Many thanks in advance for your help!

Comments

  • Options
    krzychub83krzychub83 Member Posts: 120
    It's not the answer you are looking for, but more some workaround... Are you able to export object to txt file at the time of creating 'version backup', and then uploading it back to your new table into BLOB Reference field (If you can amend the restore process too. However then change Field ID, so nobody in the future would try to TRANSFERFIELDS it back to Object record) or dedicated new BLOB field (if you wish to keep restore process as it currently is). This way you will have something that you can work with in your new Object Version table.
  • Options
    tiagoveigatiagoveiga Member Posts: 10
    Many thanks for your suggestion. I've also try to import/Export directly the Object in Text File and works fine.
    But In this case the versions/backups are done via SQL with a copy of the current record of table Object.
    I also have a "second" issue as there are objects stored like this from other databases, like one main database with Backup/Versions of the other DB.
    the Perfect solution would be to be able to export directly from the Blob Reference to Text
  • Options
    krzychub83krzychub83 Member Posts: 120
    I thought so, that you are copying records in the SQL. So let's jump to another question. Can you move some part of your development release process to the Dark Side of the Force then? It can be done manual or automatically. Like Developers would run a report to release a version on local database, which would store txt object version in Object Version table (as I already described in previous response). Then SQL Job Agent could gather records from DEV databases to centralized version database. Or you could use NAS or a combination of custom application with windows task to call NAV Web Services exposed from DEV databases. Function called from NAV Web Services could create local Object Versions and then return sent it back to central storage point. Not so easy to maintenance compared to simple SQL Job Agent record copy, but at least then you will be able to easily obtain object versions... And I have few more ideas how it can be done. All of them depends from detailed requirements (like can some DEV database become off-line due to people taking their work to home, etc…).
    In the past I used simple application to track NAV Applications in the Windows App Pool and then to pull out and back up txt versions of the files when needed. This did not require sophisticated objects in the DEV database. However this solution was using old Dev Tools entrance points, which has been closed now.
  • Options
    tiagoveigatiagoveiga Member Posts: 10
    Thanks you for your suggestions, currently this is in Stand by, but I'll let you know when we get back to this topic again! :)

    Best Regards,
    Tiago
Sign In or Register to comment.