Options

How to handle a large file returned from automation

jensthomsenjensthomsen Member Posts: 173
Hi There
(My second post today :D )
I'm calling an automation from within navision. The automation will return a XML-document:
ReturnValue := AutomationCall(Argument1,Argument2)
How can I handle the returnvalue? The encoding of the received XML-document isn't the problem! But how can I save the Returnvalue for "later use"??
Jens

Comments

  • ara3nara3n Member Posts: 9,258
    You can save the xml in a blob field, or you can parse the xml file and store it a table.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • jensthomsenjensthomsen Member Posts: 173
    Hi Rasheed (you again:-))
    I'm not so familiar working with Blobs or "parsing"! Could you give me some hints?
    What if the size of the XML exceeds the "capacity" of a Blob (=4Gb i guess)? The best thing to do, I think, would be to save/parse the XML to a file on the disc, and handle it from there?? Any clue of how to do that?
    Jens
  • ara3nara3n Member Posts: 9,258
    Hello Jens

    4 Gb is a lot of space. The size of 5 CD. That's a lot of space. You will never see an xml file of that size. Plus the file gets compressed in the blob.

    The following code creates an xml file.
    IF NOT CREATE(XMLDOMDocument) THEN
                  ERROR('could not create the xml DOM object');
    
                // Get the current Node
                CurrNode := XMLDOMDocument.createElement('String');
                CurrNode.text := 'Hello World';
    
    
                XMLDOMDocument.documentElement := CurrNode;
    
                XMLDOMDocument.save('c:\answer.xml');
              END; 
    


    This is how the xml file look like
    <?xml version="1.0" ?>
    <String>
    Hello World
    </String>
    


    The following code will save into the Item.Picture field which is a blob field.



    Item.Get('1000');
    Item.Picture.IMPORT('c:\answer.xml',false);
    Item.modify(true);
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.