Write record variable to OutStream

matthiasclaes
Member Posts: 18
Is it possible to write a complete record variable to an out stream?
This way doesn't work (from "Sales Header".OnModify):
Our NAS (running JOBQUEUE) has to perform a task when certain fields in the sales header change.
I'm trying to pass the complete xRec and Rec to the NAS Handler.
The NAS Handler will perform the evaluation of the changed fields and act upon it (asynchronous, on a different machine).
I'm not looking forward to writing all the separate fields one by one, and reading them back one by one in the NAS Handler.
Is there a way to convert a record variable to an XML structure in memory and write that into the BLOB field?
This way doesn't work (from "Sales Header".OnModify):
... "Job Queue Entry"."Parameter String" := STRSUBSTNO('DMS DOCTYPE %1', "Document Type"); "Job Queue Entry".XML.CREATEOUTSTREAM(outStream); outStream.WRITE(xRec); //This statement fails. outStream.WRITE(Rec); "Job Queue Entry".Status := "Job Queue Entry".Status::Ready; "Job Queue Entry".INSERT(TRUE);
Our NAS (running JOBQUEUE) has to perform a task when certain fields in the sales header change.
I'm trying to pass the complete xRec and Rec to the NAS Handler.
The NAS Handler will perform the evaluation of the changed fields and act upon it (asynchronous, on a different machine).
I'm not looking forward to writing all the separate fields one by one, and reading them back one by one in the NAS Handler.
Is there a way to convert a record variable to an XML structure in memory and write that into the BLOB field?
0
Comments
-
I have never tried to write a full rec in binary, but in text I have not found a way that never produces an overflow.
I think you will have to write the data field by field. You can use a Fieldref in a loop to cut down on your typing and to allow for table changes without having to change your code each time.0 -
Ther is no way other than using FieldRec as already mentioned.0
-
Thank you for the hint about FieldRefs, forgot about them.
I tried using a Variant as an intermediate variable, but that doesn't work.
Is there documentation on what data types are supported in OutStream.Write()?
I'll use the FieldRef method, it seems the most reliable and flexible.0 -
I'm still stuck. I can't use FieldRefs on my implicit Rec variable.
Those values are not yet saved in the database when the OnModify code executes, so I cannot GET() them.0 -
I believe RecRef.GETTABLE should work regardless, then use RecRef.FIELDINDEX to get the FieldRef.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions