XMLPort with Child tables

Roelof
Member Posts: 377
I want to export Sales Order data with 2 levels as of the Sales Header and Sales Lines. Is there a way to do that? The xml port is defined as format = Fixed Data (no XML format).
I was trying to define the fields as:
Root Element Text <Root>
SalesHeader Element Table <SalesHeader>(Sales Header)
HeaderField1 Element Text <HeaderField1>
HeaderField2 Element Text <HeaderField2>
HeaderField3 Element Text <HeaderField3>
..etc..
SalesLine Element Table <SalesLine>(Sales Line)
LineField1 Element Text <LineField1>
LineField2 Element Text <LineField2>
LineField3 Element Text <LineField3>
But this format doesn't seem to work since I'm getting this error:
'An element with source type Table cannot have Table element children.'
I was trying to define the fields as:
Root Element Text <Root>
SalesHeader Element Table <SalesHeader>(Sales Header)
HeaderField1 Element Text <HeaderField1>
HeaderField2 Element Text <HeaderField2>
HeaderField3 Element Text <HeaderField3>
..etc..
SalesLine Element Table <SalesLine>(Sales Line)
LineField1 Element Text <LineField1>
LineField2 Element Text <LineField2>
LineField3 Element Text <LineField3>
But this format doesn't seem to work since I'm getting this error:
'An element with source type Table cannot have Table element children.'
Roelof de Jonghttp://www.wye.com
0
Comments
-
Hi Roelof,
your assumption is correct. NAV does not allow parent/child indentation of table elements for Fixed Text or CSV format. You would have to use the Xml format instead or use a plain data structure with independent table elements for SalesHeader and SalesLine.
Hope this helps
Andrew T.1 -
Thanks Andrew. Not the answer what I would like to hear but this is what I thought. I know there is a way to do it in a classic Dataport by using CurrFile but these options no longer exist in the latest NAV versions. That sucks. I guess an alternative would be to buffer data in the right order before it exports.
Roelof de Jonghttp://www.wye.com0 -
That used to be possible
https://youtu.be/qNYrmZXUOxE
That was in 2009 though I think, not sure if it wouldn't work anymore. See if you can make this work.0 -
Today I would probably think about creating a Query based on two tables, load it into a temp table during OnPre, something like that.0
-
Hi Daniel,
I actually figured out a way doing that. I created an integer and running through all the data (parent and child), buffer it and then using an Integer that has one datasource field. I added some code in the DataItem to control the export. I string the Parent data when Parent Data needs to be exported and string the Child data when Child Data needs to be exported. The record length is for both Parent and Child the same but the layout is defined in code. It works pretty well although a bit slower than a straight export would be.Roelof de Jonghttp://www.wye.com1
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