how to send parameter from form to report?

how to send parameter from form to report?

like in purchase order form, i want to use Document No.,Item No. And Line No. (Which is they are Primary key)

i made a new report

it’s already finish… but how to send parameter from Purchase order form to my report

so they can fill to variable that i made in that report

I have variables : DocNo (code), LineNo(Integer), ItemNo(code)

please help me :slight_smile:

thanx for any answers

Hi Stan,

You can define a function in Your report (e.g. SetPars), and send the values You need into this function as parameters.
Then in the function You can assign the parameter-values to Global Variables defined in the report.

You can also look into using SETTABLEVIEW, if what You actually want to do, is to be able to find a specific record, once inside Your report.

In the form? do we need to add code?

for your information variable that i made is in the request form (report)

Hi Stan,

First you need to create a function in your report to set the parameter. DocNo is a global variable that you want to fill in the value from form.

setPar(parDocNo : Code[20])

DocNo := parDocNo

Then, you can call this function to set the parameters when you call your report. For example :

YourReport.setPar(“Document No.”);

YourReport.RUNMODAL;

In Purchase Orders → Purchase Order Subform i made function like this : TESTFIELD(Type,Type::Item); BEGIN BarcodeSN.RESET; BarcodeSN.SETRANGE(“Document No.”,“Document No.”); BarcodeSN.SETRANGE(“Item No.”,“No.”); REPORT.RUNMODAL(REPORT::“Inserting SN Barcode”,TRUE); END; all that i want is that Document No. could be fill in the DocNo Variable in Report “Inserting SN Barcode” By The Way, I Have tried your code I made a function called SetPar and then I save it (compiled) setPar(parDocNo : Code[20]) DocNo := parDocNo but it didn’t work and restart my navision application :frowning:

Hi, Stan

maybe you didn’t follow Teddy’s advice correctly. This technique may be tricky to understand at first - I also had troubles with it.

SetPar is intended to be a function in the report. It receives the local variable parDocNo and assigns it to global variable which will be available to the whole report.

When you call the report from your form, you must define it as variable and access it (the report) through that.

So your code should look like this:

TESTFIELD(Type,Type::Item);

CLEAR(YourReport);

BarcodeSN.RESET;

BarcodeSN.SETRANGE(“Document No.”,“Document No.”);

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

YourReport.SetPar(“Document No.”);

YourReport.SETTABLEVIEW(BarcodeSN);

YourReport.RUNMODAL;

Please take notice: not “REPORT.RUNMODAL(REPORT::“Inserting SN Barcode”,TRUE)” this would call a different instance of the abovesaid report and the variables in it would be initialized.

IT WOrks !! :slight_smile: thanx for all your answers :)))

You are welcome. [:)]