Quintiq file version 2.0
#parent: #root
Method GenerateBirtReport (
  String name,
  NamedValueTree parameters,
  String formatstring
) id:Method_ApplicationLibMacroPlanner_GenerateBirtReport
{
  #keys: '[107654.0.429175480]'
  Body:
  [*
    //Generate and show BIRT report
    mdsid := MDSID::Create( MacroPlan.MDSID() );
    options := BirtGenerateOptions::CreateUseMDS( mdsid, parameters );
    report := BirtReportDesign::LoadDesignFromQFS( name );
    document := report.Generate( options );
    //ApplicationMacroPlanner.ReportManager().PreviewBirtDocument( document );
    
    // output render format
    format := constnull( BirtRenderFormat );
    
    if ( formatstring = "HTML" )
    {
      format := BirtRenderFormat::Html();
    }
    else if ( formatstring = "PDF" )
    {
      format := BirtRenderFormat::Pdf();
    }
    else if( formatstring = "DOC" )
    {
      format := BirtRenderFormat::Doc();
    }
    else if( formatstring = "XLS" )
    {
      format := BirtRenderFormat::Xls();
    }
    else if( formatstring = "PPT" )
    {
      format := BirtRenderFormat::Ppt();
    }
    info( 'GenerateReport', formatstring, format.Extension() )
    ApplicationLibMacroPlanner.ReportManager().ShowBirtDocumentAs( document, format );
  *]
}
