how to save an report as xml file?

ganeshganesh Member Posts: 32
edited 2008-01-03 in Navision Attain
hi everyone..
i'm facing problem in saving an report as xml file..
i wrote
if(currreport.saveasxml('c:\myxml.xml')) then begin
message('done');
end else begin
message('notdone');
end;

when i give the above code in OnInitReport() it gives an error message stating that "please enter date"(since date is an mandatary to run the report).
when i give in it OnPreReport() it give error message "report 0 does not exit"
when i give it in OnPostReport() it gives the same error..

please help me by giving some tips--where to write the code...

and also is there any provision to pass parameter to report when called through codeunit..(like date which is mandatory to run the report)

thank you

bye
Ganesh
if (better is possible)
{
good is not enough
}

Comments

  • wonmowonmo Member Posts: 139
    Create a function on the report which will take the date as a parameter and set a global variable to that date.

    something like:

    var_SomeDate := parameter_SomeDate;

    Now, when you code and call that report, pass the parameter to the function first and then set the XML parameters. This is all you have to do:

    report_SomeReport.function_DateSet(090903D);
    report_SomeReport.SaveAsXML('c:\SomeXMLFile.xml);

    Remember, SaveAsXML implies a RUN command.
  • ganeshganesh Member Posts: 32
    hi wonmo..
    thanks for the reply and your solution is working properly..thank you once again...
    can you please give a solution to save the report as xml file using the fuction
    currreport.saveasxml(filename);
    for report where date is mandatory..

    thank you

    bye
    Ganesh.
    if (better is possible)
    {
    good is not enough
    }
  • RoelofRoelof Member Posts: 377
    Any answer on that 'currreport.saveasxml(filename)' question from Ganesh? (His last question).
    Roelof de Jonghttp://www.wye.com
Sign In or Register to comment.