Dynamics User Group
Since 1995 - The Microsoft Dynamics Online User Community

how to send parameter from form to report?

rated by 0 users
This post has 8 Replies | 0 Followers

Top 50 Contributor
Male
Posts 395
Points 7,630
Member since 01-21-2007
stan Posted: 09-25-2007 14:21

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 :)

thanx for any answers 

The True Test Of Man's Character Is What He Does When No One Is Watching....
  • | Post Points: 20
Top 50 Contributor
Male
Posts 343
Points 6,600
Member since 09-10-2001

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.

 

Regards,

Alexander Pallesen
Freelance Navision Developer

"Life is a terminal disease that You just have to learn to live with"

  • | Post Points: 20
Top 50 Contributor
Male
Posts 395
Points 7,630
Member since 01-21-2007

 In the form? do we need to add code?

The True Test Of Man's Character Is What He Does When No One Is Watching....
  • | Post Points: 5
Top 50 Contributor
Male
Posts 395
Points 7,630
Member since 01-21-2007

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

The True Test Of Man's Character Is What He Does When No One Is Watching....
  • | Post Points: 20
Not Ranked
Male
Posts 29
Points 530
Member since 04-27-2006

 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;

  • | Post Points: 45
Top 50 Contributor
Male
Posts 395
Points 7,630
Member since 01-21-2007

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 :(

The True Test Of Man's Character Is What He Does When No One Is Watching....
  • | Post Points: 20
Top 10 Contributor
Female
Posts 1,414
Points 20,781
Member since 02-26-2001
DynamicsNAVMVP
Moderator

stan:

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 :(

 

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.  


Anna Perotti MS Dynamic Nav MVP
Top 50 Contributor
Male
Posts 395
Points 7,630
Member since 01-21-2007

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

The True Test Of Man's Character Is What He Does When No One Is Watching....
  • | Post Points: 20
Top 10 Contributor
Female
Posts 1,414
Points 20,781
Member since 02-26-2001
DynamicsNAVMVP
Moderator

stan:

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

 

You are welcome. Smile

Anna Perotti MS Dynamic Nav MVP
  • | Post Points: 5
Page 1 of 1 (9 items) | RSS


Copyright Dynamics User Group, 1995-2009, all rights reserved. The Dynamics User Group is not affiliated with Microsoft Corporation.