How to move data in blob fields between tables

girish.joshigirish.joshi Member Posts: 407
edited 2007-05-25 in NAV Tips & Tricks
If you have data in a blob field that you'd like to move into a blob field in another table, use something like this:
    sourceBuffer.CALCFIELDS(TextData) ;
    sourceBuffer.TextData.CREATEINSTREAM(linsStream) ;
    linsStream.READTEXT(ltxtData) ;

    destinationBuffer.TextData.CREATEOUTSTREAM(loutStream) ;
    loutStream.WRITETEXT( ltxtData ) ;
    destinationBuffer.MODIFY ;

of course the above snippet assums the blob was made up of text data. If not, reads and writes instead of readtext and writetext. Also, make sure your 'temp variable' (ltxtData) is of type Binary not Text.

Comments

  • ara3nara3n Member Posts: 9,256
    You could just assign the fields. make sure you do calcfields.

    E.g.
    companyinfo.get;
    companyinfo.calcfields(Picture);
    Item.get('001');
    Item.Picture := Companyinfo.picture;
    Item.modify;
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • MissesMagicMissesMagic Member Posts: 39
    Or, if you want to use Streams - use COPYSTREAM,

    therefor you don´t need the READTEXT & WRITETEXT
Sign In or Register to comment.