How To Save A Report as HTML file when i run the report.

lakshmanlakshman Member Posts: 44
Hi All,

i want to save a report in html while running the report .i used the code like below
REPORT.SAVEHTML(currentreportid,'filepath' ); in report 'on post report' trigger.
it gives an error like 'insufficient Memory in disk'. if i give any other integer .it gives html file of
a report ,what i given number . but i want the same report as html file ,when i run a report.
is it possible please give me suggestions.

Thanks & Regards:
lakshman
Best Regards,
Lakshman Routu
http://lakshman-routu.blogspot.in/

Comments

  • Dave_CintronDave_Cintron Member Posts: 189
    I believe you are not supposed to use this from INSIDE the report, but as a replacement for REPORT.RUN, hence the memory error caused by the infinitely nested call.
    Dave Cintron
    Dynamics West
    http://www.dynamicswest.com
  • mrigyamrigya Member Posts: 124
    Hope this would solve your problem.
    ok,SystemPrinter...booleab type variables.

    RecItemLedger..record type variable.
    ok:= Report.SAVEASHTML(reportid, 'filename',SystemPrinter,RecItemLedger)
    

    Write it OnPost Section of Report

    Regards
    Mrigya
  • kinekine Member Posts: 12,562
    lakshman wrote:
    Hi All,

    i want to save a report in html while running the report .i used the code like below
    REPORT.SAVEHTML(currentreportid,'filepath' ); in report 'on post report' trigger.
    it gives an error like 'insufficient Memory in disk'. if i give any other integer .it gives html file of
    a report ,what i given number . but i want the same report as html file ,when i run a report.
    is it possible please give me suggestions.

    Thanks & Regards:
    lakshman

    Cannot be done in this way, because you are in neverending loop of saving this report as HTML (SAVEHTML will run the report, which inside call SAVEHTML which run the report..).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • garakgarak Member Posts: 3,263
    You can only use
    REPORT.SAVEASHTML(Number, FileName [, SystemPrinter] [, Record])
    
    before you run the report.

    An other method is, to select a printerdriver that creates a HTML (Like a PDF printer)
    Do you make it right, it works too!
  • WoFWoF Member Posts: 5
    I solved the problem to avoid the deeper recursion:
    Report - OnInitReport()
    // Initialisation of options in request form
    GboolSimulationMode := TRUE;    // not neccessary for save as html
    GtxtSavePathName := 'C:\Report70321_Suppliers_Declaration.HTML';
    
    Report - OnPreReport()
    // Here switch GboolRun first/second call of report in recursion
    // in root GboolRun ist false and lines in IF will executed
    IF (NOT GboolRun) AND GboolSaveAsHTML THEN BEGIN
      // Say the second recursion that no more recursion is required
      LrepMySelf.SetSaveAsHTML;
      // pass all option-parameters from request form to second recursion
      LrepMySelf.SetGlobalParameters(GboolSimulationMode);
      // start the recursion to save as html
      LrepMySelf.SAVEASHTML(GtxtSavePathName);
      // all done
      CurrReport.QUIT;
    END;
    
    SetGlobalParameters(PboolSimulationMode : Boolean)
    GboolSimulationMode := PboolSimulationMode;  // not neccessary for save as html
    
    SetSaveAsHTML()
    GboolRun := TRUE;                 // here we say we are in second recursion
    GboolSaveAsHTML := FALSE;   // turn off the option flag from request form to save as html
    

    names of variables:
    first letter: G=global, L=local, P=parameter, R=returnvalue, V=variable parameter
    next less letters: bool=boolean, txt=text, rep=report, ...
    rest of name free to describe

    But i can't see how the filter from request form can be passed simple for all dataitems.
Sign In or Register to comment.