export objects via codeunit

hi … is it possible to export some objects like tables i.e. with code ? … a small example would be fine thx alex *** quack ***

Sure this is possible, but not the same way as it is done from object designer and import/export! Here is an example:


Documentation()
//
OnRun()
{
myObject.SETRANGE(Type,myObject.Type::Codeunit);
myObject.SETRANGE(ID,87050);
IF myObject.FIND('-') THEN
  ExportObject(myObject,'c:\87050.fob');
}
//
myObject.Type := myObject.Type::Codeunit;
myObject.ID := 87051;
myObject.Navn := 'myObject';
myObject.INSERT;
ImportObject(myObject,'c:\87050.fob');
//
ExportObject(VAR Object : Record Object;BLOB : Text[80])
myObject.CALCFIELDS(myObject."BLOB-reference");
myObject."BLOB-reference".EXPORT(BLOB,FALSE);
//
ImportObject(VAR Object : Record Object;BLOB : Text[80])
myObject."BLOB-reference".IMPORT(BLOB,FALSE);
myObject.MODIFY;

This should actually do the trick. If you want to run comparison on the different objects you would need to write additional code to compare files etc. I know people usually answers no to this question, but i can be done. Of course you would want to export the object record along with the blob-reference, in order to be able to import it again. This way you can actually do your own (intelligent?) object loader for Navision. /Soren Edited by - SNielsen on 2001 Oct 04 13:38:40

See this topic too: http://www.navision.net/forum/topic.asp?TOPIC_ID=2396&FORUM_ID=9&CAT_ID=3&Topic_Title=System+objects+accessed+from+CAL&Forum_Title=Attain%2FFinancials+-+Developer+Forum /Soren

The difference between this approach and the fob files generated by Navision is: 1. FOB has the header information included from the object table. 2. FOB has a checksum included too - i think! /Soren

thx this will help me a lot i think :slight_smile: alex *** quack ***