Unable to store XML document in BLOB

Can someone give me a hint on why the BLOB field named MSG appears to be empty after executing the code below? Regards, Nico Glasbergen Aucon B.V. Variables: objQueue : Record, SysMsgQueue .NAME : Text(100) .MSG : Blob objStream : OutStream StoreMsgInQueue(VAR theMessage : Automation “‘Microsoft XML, version 2.0’.DOMDocument”) { Creates a record in SysMsgQueue Parameters: - theMessage: DOM Document containing the XML message} WITH objQueue DO BEGIN INIT; NAME:= theMessage.documentElement.nodeName; MSG.CREATEOUTSTREAM(objStream); theMessage.save(objStream); INSERT; END;

maybe you forget a CALCFIELDS() on the blob-field befor you access its content? then it appears emtpy.

Try Instream instead of Outstream when saving into a BLOB Variables: objQueue : Record, SysMsgQueue .NAME : Text(100) .MSG : Blob MyInStream : InStream StoreMsgInQueue(VAR XMLDoc : Automation "'Microsoft XML, version 3.0'.DOMDocument") // 2.0 may work, but I've only worked with 3.0 so far WITH objQueue DO BEGIN INIT; NAME:= XMLDoc.documentElement.nodeName; MSG.CREATEOUTSTREAM(MyInStream); XMLDoc.save(MyInStream); INSERT; END; And when you want to read it from the table, you use Outstream Variables: MyOutStream : OutStream // Assuming I have a valid record in objQueue WITH objQueue DO BEGIN CALCFIELDS(MSG); IF MSG.HASVALUE THEN BEGIN MSG.CREATEOUTSTREAM(MyOutStream); XMLDoc.load(MyOutStream); // add your XMLDoc processing code here END; END;