how to invoke anther report

hello all, how to invoke anther report in the first report, the second report run automatically without any request form pop up and do not need any print just process. “r.run” exist the problem: pop up request form,must press preview button. “report.run” exist two problem,1st point is it will print,I just need preview,2nd point is the first report parameters can not tranfer to second report. I want use the way combine 3 reports, let they run automatically in non work time(night,sunday) can you help me [?]

darn, I had quite the post for you, but when I pressed F5 to access the “C/AL Symbol Menu” ie refreshed my page. oooh well… here we go again You should not call the second report from the first and the trird from the second. Make a codeunit which prints the reports. Use a RUNMODAL to make sure the processing of the code in the codeunit will not continue while running the report. I don’t think it’s possible to set a report as preview only. “Parameter” can be set when running a report: cust.SETRANGE("No.", foo, bar); item.SETRANGE("No.", foo); custitem.SETTABLEVIEW(cust); // Set filter on first customer dataitem in report. custitem.SETTABLEVIEW(item); // Set filter on first item dataitem in report. custitem.USERREQUESTFORM(false); custitem.RUNMODAL;

Peter, maybe it’s even better to do it from a report, because in this case it is easyer to allow the user to enter filters. You can use functions like getfilters to apply the filters from your master report to the subreports. The master report itself would not have any processing. It just runs the subreports. Another tip I can give you. Take a look at the way documents are printed from e.i. a sales order print. You can define multiple reports to print after each other. You define them in the sales setup (report selections). greets Francis

Francis, I know your mean,here I give you the enduser requisition following: because it take about 4 hours to run report “adjusted cost inventory entry” and after the report finished they will run report “posting inventory to g/l”, the second report will spend long time too,then they will take long time to run 3rd report “wip inventory code adjusted”(we own developed) again,so they hope press preview botton in the first report when work off, next day they will seen all result. do you understand me,plese help me thank you Emiel, I will try it thanks Peter

Yes, well… Are you sure you want to generate a report on paper or screen? If this is not necessary you could run all reports without a user request form. You can make a codeunit (or a function in a table) which will be runned when you, for example, choose “this” option in the periodic activities menu. do something like this in the codeunit: adjustedcostinventoryentry.USERREQUESTFORM(false); adjustedcostinventoryentry.RUNMODAL; postinginventorytogl.USERREQUESTFORM(false); postinginventorytogl.RUNMODAL; wipinventorycodeadjusted.USERREQUESTFORM(false); wipinventorycodeadjusted.RUNMODAL;

Emiel I try to test,the requestform did not pop up but the report will print, you know the reports are very big(about 1000 pages),so can not let they output to printer. thank you very much. have you idea to solve the problem peter

Have you looked at the report properties UseReqForm and ProcessingOnly?

Peter Dam, The report can not print after set ProcessingOnly to True,but can the the program/code control the properties?so that I can create a check box in request form Option for navision operator,it is best to preview for operator checking or save to disk thanks peter xiong

Peter, What you could try (hope your version supports it) id starting the report with the SAVEASHTML propertie. reportname.USERREQUESTFORM(false) reportname.SAVEASHTML('c:\foo.html'); reportname.RUNMODAL;

btw, If you save your report as html, set ProcessingOnly back to it’s orginial setting.

thank everyone /peter xiong

did it work?

Hi All Didn’t you forget something? The user has to set at least Posting Date & Document No. in the request form of the report “posting inventory costs to g/l”. And- I guess the user wants to filter the item ledger entries by periods. bye André

Not if you use Posting Methode : Per Entry, or do you have to fill it. Well… We will find out soon :wink:

Emiel, yes,I will use Per entry,and other fields must be filled,but I can transfer parameters from the first report requestform(I added new filter field according to 2nd report filters),so no problem about these,but I have another problem: the system show me “the report have been run,please use function clear(report)”, I use clear(myreport) following myreport.run/myreport.runmodel.line, the system show me the same message again can you help me. thanks peter xiong

Sure. Everytime you run a report you have to clear it. Just like you did. But just check to be sure you did the right thing: clear(report); report.function(foo); report.runmodal;

At first my code is: rptPostInventoryCostToGL.SetConditions(PostingDate,PostLevel,PostingDocNo,RunAt,TRUE); rptPostInventoryCostToGL.USERREQUESTFORM(FALSE); rptPostInventoryCostToGL.SAVEASHTML(‘E:\PostInventoryCostToGL.html’); rptPostInventoryCostToGL.RUNMODAL(); CLEAR(rptPostInventoryCostToGL); I changed the code and test,the new code is below: CLEAR(rptPostInventoryCostToGL); rptPostInventoryCostToGL.SetConditions(PostingDate,PostLevel,PostingDocNo,RunAt,TRUE); rptPostInventoryCostToGL.USERREQUESTFORM(FALSE); rptPostInventoryCostToGL.SAVEASHTML(‘E:\PostInventoryCostToGL.html’); rptPostInventoryCostToGL.RUNMODAL(); but the same error message pop up again. It is urgent to me.pls help me,thanks

At first my code is: rptPostInventoryCostToGL.SetConditions(PostingDate,PostLevel,PostingDocNo,RunAt,TRUE); rptPostInventoryCostToGL.USERREQUESTFORM(FALSE); rptPostInventoryCostToGL.SAVEASHTML(‘E:\PostInventoryCostToGL.html’); rptPostInventoryCostToGL.RUNMODAL(); CLEAR(rptPostInventoryCostToGL); I changed the code and test,the new code is below: CLEAR(rptPostInventoryCostToGL); rptPostInventoryCostToGL.SetConditions(PostingDate,PostLevel,PostingDocNo,RunAt,TRUE); rptPostInventoryCostToGL.USERREQUESTFORM(FALSE); rptPostInventoryCostToGL.SAVEASHTML(‘E:\PostInventoryCostToGL.html’); rptPostInventoryCostToGL.RUNMODAL(); but the same error message pop up again. It is urgent to me.pls help me,thanks

Hi Peter

quote:


Originally posted by peterxiong
1. rptPostInventoryCostToGL.SAVEASHTML(‘E:\PostInventoryCostToGL.html’); 2. rptPostInventoryCostToGL.RUNMODAL(); …


It seems you run the report twice. Didn’t you get a result with 1.? I don’t know? Or try to change 1. and 2.. YEP. To look into the helpfile is sometimes helpful [;)].

quote:


Comments
The SaveAsHTML function can be used on the Report type and on Report variables. FileName is the path and name of the file you want to print to. The use of the parameters Number, SystemPrinter and Rec is similar to that of the report functions RUN and RUNMODAL. When SaveAsHTML is called, the report is generated and saved to “FileName.” The standard system status box “Saving to HTML” shows the status of the process. You can manually cancel the generation of the report and the saving of the report as an HTML file. Please note that the RequestForm will not be shown.


bye André

Andr,Emiel, everything is ok,thank you very much.