Passing Value to Report DataItem Integer

I have a report with the folling structure

Integer - CopyLoop

– Record Item

I now want to run the report with predefined values from an action like this:

Item.SETRANGE(“No.”, ‘123456’);

This works, but how can I pass the value for the copy loop?

pseudo: Rep.SETTABLEVIEW(3);

This does not work because a record is obviously no integer

Why you want to pass value to copyLoop ??

If you want to create a function called something like SetCopyLoopValue(par 1, par 2, …) and in this function assign the parameter values to global variables in the report object to be used in your copyloop. Then change your code to

Typo in my text above. The first should be: “If you want create …”

I tried your solution, got this error message:

Report state information cannot be ransferred to Microsoft Dynamics NAV CLassic client report from the RoleTailored client. One or more of the public functions on report 50070 has been called before running the report.

As I interprate the message, your solution does not work with the RTC?

@Amol, we have a complex report for Label printing, During the printing process, the user decides the size of the labels and the logo. However we want to automatically print the specific labels during a purchase order process. The user clicks the “print label” on a purchase order line, decides once which logo and label size and the report print the number of quantities of the line as labels

I cannot see into your report or what you exactly are doing, but I think this message is not related to what I suggested.

Does it somehow relate to this:

And in addition: how is the report being called/tiggered?

This is the code in the action of a the purchase order subform page

// Item = Record:Item
// Print75 = Report 50070 PrintLabel75

Item.SETRANGE(“No.”, “No.”);

This is the code of SetCopies

IF var < 0 THEN
var = 0;

NoOfCopies := var;

This is the Code of the CopyLoop DataItem:

CopyLoop - OnPreDataItem()

NoOfLoops := ABS(NoOfCopies) + 1;

SETRANGE(Number, 1, NoOfLoops);

CopyLoop - OnAfterGetRecord()

CurrReport.PAGENO := 1;

CopyLoop - OnPostDataItem()



Did you ‘read’ the link? And do you have an answer to my additional question above?

I will test this with the RDLC. Thank you

?? Are you going to answer my questions or not ??

I thought i did answer your question?

Did this link somehow relate to your problem: → maybe, i need to test it with the rdlc
question2: how does your code look like: i answered it

which question do you mean?

OK, clear now.

That was clear

how is the report being called/triggered?

For example: by user? through code? on RTC? on Classic Client? …

THe report will be triggered by a user click on an action

We have lines on a purchase order. The user selected the line and clicks on the action “Print label”. The report should print out as many copies as there are quantity of the item.

e.g. Item No ‘123’ has been ordered 10 times, 10 labels should be printed out.

As soon as the report starts the user only selected the label type and the logo with a substrmenu. the logo gets loaded dynamically from a png file and placed on the label. also there will be several barcode/eans generated and some other warehouse / retail stuff

The action get triggered on a RTC page, but the report will be is a classic report

Is this report then called using Code (e.g. REPORT.RUN or REPORT.RUNMODAL)? Or by means of a property (e.g. RunObject)?

As in my 1st and 3rd post:


Indeed (stupid me; sorry for that).

Calling a REPORT on RTC by code needs RDLC on the report. It cannot launch the classic report (layout). And that’s actually what your error message is saying (and why I referred to the post

Running classic reports from RTC is only possible when calling a report through RunObject.

Ok got that. But why does it work when I leave out the line

Report.SetCopies(value); ?

Lets Say

Item.SETRANGE(“No.”, ‘1111’);

works but

Item.SETRANGE(“No.”, ‘1111’);

does not.