Hello,
So after exhausting all other possibilities while debugging some code I ran into this situation and am hoping that somebody can explain it to me:
I'm running a report that will print all related posted sales invoices if a boolean is flagged TRUE. So I made the variable SalesInvoiceHeader to pass into
REPORT.RUN(50204,FALSE,FALSE,SalesInvoiceHeader);
Now, originally I was doing this ("Document No." is the PSI number):
IF SalesInvoiceHeader.GET("Document No.") THEN BEGIN
REPORT.RUN(50204,FALSE,FALSE,SalesInvoiceHeader);
The report would run, but the dataitem is empty and it would error out.
However, when I do this:
SalesInvoiceHeader.SETFILTER("No.","Document No.");
IF SalesInvoiceHeader.FIND('-') THEN BEGIN
REPORT.RUN(50204,FALSE,FALSE,SalesInvoiceHeader);
Everything worked fine.
So why does one work, but not the other??
They both will get me the one record I want to pass, I can't see the difference here...
Thanks in advance for some enlightenment
Answers
Find vs get is irrelevant
RIS Plus, LLC
Why? The first command generated in the Report Execution is something like
IF NOT rec.FINDSET then exit....
So if there is no record in the filter, then the report wont run.
This is in that big flow chart in the user manual about how all objects execute.
RIS Plus, LLC
Ah gotcha, some how I read "empty" as "error"