Exporting data from two tables
downtap
Member Posts: 18
Hi All,
Here's what I'm trying to do.
I have two tables, a header and a line table. I'd like to output some data from the two, such as
Header1DataItem, Line1DataItem1, Line1DataItem2
Header2DataItem, Line2DataItem1, Line2DataItem2
etc.
The two tables are mainly used on a form/subform. In the example above, the first line is from one form & subform, and the second line is from another form and subform. I do know that I cannot use a dataport to export an indented tables. Is my only option an xml port or a proccessing only report? If so, can anyone give me a nudge in the right direction to try those?
I hope I explained that clearly enough, kind of hard to describe. Thanks in advance for any and all help!
-Patrick
Here's what I'm trying to do.
I have two tables, a header and a line table. I'd like to output some data from the two, such as
Header1DataItem, Line1DataItem1, Line1DataItem2
Header2DataItem, Line2DataItem1, Line2DataItem2
etc.
The two tables are mainly used on a form/subform. In the example above, the first line is from one form & subform, and the second line is from another form and subform. I do know that I cannot use a dataport to export an indented tables. Is my only option an xml port or a proccessing only report? If so, can anyone give me a nudge in the right direction to try those?
I hope I explained that clearly enough, kind of hard to describe. Thanks in advance for any and all help!
-Patrick
0
Comments
-
Assuming you are working on a dataport, you can export variables as well as fields. use the line table as a dataitem, get the associated header record for each line, and set the variables to the field values.0
-
Thanks a ton for the help! I'm still somewhat a novice programmer, so bear with me through this.
Here's what I've started:
The line table is set as the data item for the dataport.
In my code I have the following in the OnBeforeExportRecord section:HeaderTableVariable := "Header Table Field"; LineTableVariable := "Line Table Field 1"
Now, obviously I've stripped this down to its core. This, as it should, repeats the header field for every line variable. I'd like the header variable to only print once for all the line variables associated with it. Do I need to code a REPEAT or FOR Loop? Sorry for such a basic question, but programming is definitely not my strong suit in Navision.
0 -
Dataports can't be indented, it's always a flat file. You can't have 1 hdr, 2 lines, 1 hdr, 2 lines. Instead you can have 2 lines, 2 lines, and in each line you repeat the values from the header record by using a variable as the sourceexpr for the dataport fields.
You don't have to program any loop, the dataport's dataitem will do the looping.
Get a hold of a product disc, and look for a file called w1w1adg.pdf, in the Doc folder. This document contains technical information on how to use dataports. You should also get the C/SIDE Introduction and C/SIDE Development courses. If you don't have access to partnersource or customersource, purchase David Studebaker's book on programming in NAV.0 -
Ok, maybe this is possible. On one table I have the following data:
No. SampleField1
1 Mary
1 John
2 Jane
2 Jack
Is it possible to write a dataport that outputs this:
1, Mary, John
2, Jane, Jack
Does that make sense at all? Thanks again for the help!0 -
-
Just wanted to say thanks, finally got everything working great. As a reference to anyone who might find this thread, I used a processing only report to export the data due to some possibly max line lengths. It worked best anyways as a report since I wrote the file as a .bat file and also have the report run the batch file at the end. Great solution, just trick getting the code to 'flatten' the data. Thanks again.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
- 323 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
