Line loop

axBobSE
Member Posts: 17
I seem to be missing a table referance somewhere.
I have a report with 2 dataItems salesInvoiceHeader salesInvoiceLine
the Header got x lines bound to it. On the data items I make a file that with the data from the tables.
salesInvoiceHeader salesInvoiceHeader
salesInvoiceLine salesInvoiceLine
This all works as intended (included it incase it was there I missed something)
I created a Body for the salesInvoiceHeader
with some Labels and TextFields and put the Sourcescr= salesInvoiceHeader.fields
(this is shown as I want with the data from the SalesInvoiceHeader)
Now the problem
I created a salesInvoiceLine Header with some labels in a line, and under that I created a body with a matching line containing textFields where I set the Sourcescr = salesInvoiceLine.field.
But I dont seem to have a referance to the salesInvoiceLine in my body
what am I missing to get the referance to the lines? into the SalesInvoiceLine body?
I have a report with 2 dataItems salesInvoiceHeader salesInvoiceLine
the Header got x lines bound to it. On the data items I make a file that with the data from the tables.
salesInvoiceHeader salesInvoiceHeader
salesInvoiceLine salesInvoiceLine
salesInvoiceHeader - OnPreDataItem() SETRANGE("Nummer",InvoiceNum); salesInvoiceHeader - OnAfterGetRecord() ...f.WRITE(record)... salesInvoiceLine - OnPreDataItem() SETRANGE("Bilagsnr.",InvoiceNum); salesInvoiceLine - OnAfterGetRecord() REPEAT ...f.WRITE(record) UNTIL NEXT = 0;
This all works as intended (included it incase it was there I missed something)
I created a Body for the salesInvoiceHeader
with some Labels and TextFields and put the Sourcescr= salesInvoiceHeader.fields
(this is shown as I want with the data from the SalesInvoiceHeader)
Now the problem
I created a salesInvoiceLine Header with some labels in a line, and under that I created a body with a matching line containing textFields where I set the Sourcescr = salesInvoiceLine.field.
But I dont seem to have a referance to the salesInvoiceLine in my body
what am I missing to get the referance to the lines? into the SalesInvoiceLine body?
0
Answers
-
I bet it has something to do with the REPEAT UNTIL in the salesInvoiceLine dataitem. To get all the invoice lines into your file, all you have to do is put one f.WRITE(record) in OnAfterGetRecord, the report will do the looping for you. It will execute the OnAfterGetRecord trigger for all records in the filter.0
-
oh it had, when I removed the REPEAT/UNTIL it worked O:)
Thanks DenStar.
btw, REPEAT/UNTIL when would that be used, only if its a variable (tabel) your iterating through?0 -
axBobSE wrote:oh it had, when I removed the REPEAT/UNTIL it worked O:)
Thanks DenStar.
btw, REPEAT/UNTIL when would that be used, only if its a variable (tabel) your iterating through?
You need it when you are not in the report and you are not using the OnAfterGetRecord trigger. Because this loop is done automatically by the report...0 -
ok, think I got it now, thanks again.0
-
axBobSE wrote:Thanks DenStar.
good to hear you got that to work
You'd use REPEAT UNTIL for loops that you want to execute at least once, until the condition evaluates to TRUE
For loops that you only want to run if a certain condition is TRUE (0 times or more) you'd use WHILE
You don't need to use either one in a report, at least not for tables that you have a dataitem for, because the report will do the looping for you.
Check the C/SIDE reference guide, under the help menu for more information about syntax, and a document called w1w1adg.pdf in the Doc folder on your product disc for more detailed application designer information.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