Welcome! Log In Create A New Profile

Advanced

Printing/sending invoices with correct line sequence

Posted by Mike James 
Printing/sending invoices with correct line sequence
March 19, 2026 11:52PM
I generate invoice as PDFs or files of various types, eg XML, CSV. I had trouble retaining the original line sequence as per the source transaction.

Typically I scan a data source of invoice headers, and within the scan I filter another data source for all the invoice lines for that invoice, then scan those lines to generate the output:

FOR EACH <invoice header data source>
- Using HFilter, filter the invoice lines data source for that invoice (ordered by invoice and linenumber)
- FOR EACH <invoice lines data source>
- - Print the invoice report or create the output file

I tried 3 different ways to filter the invoice lines data:

1. FOR...EACH <invoice lines data source> - did not return the correct set of data, even though a display of the data source in the debugger showed the correct set of lines.

2. WHILE HOut(<invoice lines data source>) - correct invoice set but the lines were in random order

3. FOR EACH <invoice lines data source> where "saleid = '" + <invoice number data source>.saleid + "'" ON LineNumber

#3 worked correctly. The "where clause" created the correct subset of data, and "ON linenumber" retained the correct line sequence.

See [doc.windev.com].

This may be well known but not to me. Shared for anyone who can benefit!
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: