Initiate Jet Report from Navision Menu

KyleaKylea Member Posts: 39
Hi all,

Lots of comments about Jet Reports and have been using them for a few months now here and there. I can not find any example of how to call a Jet Report from a Navision menu. Can this be done? I tried using
SHELL('C:\Temp\MyJetReport.xls')

from the ONPush trigger on the menu item - but the Shell command failed saying that my operating system could not execute the program 'C:\Temp\MyJetReport.xls'

As always any assistance is greatly appreciated.

Cheers

Kylea.

Comments

  • SavatageSavatage Member Posts: 7,142
    have you tried changing it to Hyperlink?

    HYPERLINK('C:\Temp\MyJetReport.xls');
  • KyleaKylea Member Posts: 39
    =D> Of course it would have to be that simple.

    I read the help text for both SHELL & HYPERLINK and from that decided that HYPERLINK would not do it. Just shows you how wrong you can be.

    Thankyou

    Kylea.
  • SavatageSavatage Member Posts: 7,142
    The Hyperlink allows windows to use the extension associations therefore the proper application is used when opening a file.

    hyperlink a doc & word opens
    hyperlink a pdf & abobe reader opens
    hyperlink a xls & excel opens
    etc.
  • andrewcoperandrewcoper Member Posts: 13
    There is a section in the Jet Reports help that explains how to launch excel from within Navision

    Andrew
  • shermangshermang Member Posts: 3
    The example in the help document (which I've copied here) is much better because you can pass values to the report to use in filtering the report.

    Name DataType Subtype
    XL
    Automation
    'Microsoft Excel 10.0 Object Library'.Application

    Workbook
    Automation
    'Microsoft Excel 10.0 Object Library'.Workbook

    Worksheet
    Automation
    'Microsoft Excel 10.0 Object Library'.Worksheet


    OnRun()

    {To reuse existing instances of Excel, use CREATE(XL)}

    IF CREATE(XL, TRUE) THEN BEGIN

    {Workbooks don't necessarily start visible or interactive. Since the user will interact with the workbook, you need to set the below values.}

    XL.Interactive := TRUE;

    XL.Visible := TRUE;


    {Add-ins do not automatically open when using automation, so the Jet Reports add-in must be opened below. You must also open any other add-ins that are needed.}

    XL.Workbooks.Open("C:\Program Files\JetReports\JetReports.xla");

    {Open the report workbook.}

    Workbook := XL.Workbooks.Open("C:\Program Files\JetReports\Reports\Finance Graph.xls");


    {Update the report options. The option values are in single cell named ranges.}


    Workbook.Names.Item('PeriodType').RefersToRange.Value := 'Week';

    Workbook.Names.Item('DateFilter').RefersToRange.Value := '1/1/01..3/31/01';

    {Run the jet report.

    IMPORTANT NOTE:

    Jet Reports intends to keep the below command working in future versions of Jet Reports. All other menu commands might change. They might work now, but could break in future version. Please do not use any other Jet Reports commands in your software.}

    XL.Run('JetMenu','Report');

    XL.Run('Events');


    {In some cases all the below steps may not be desired. Perhaps the user wants to drilldown and examine the report in Excel.}

    {Choose a worksheet and launch print preview. The user can cause the report to print if desired.}

    Worksheet := Workbook.Worksheets.Item('Report');

    Worksheet.PrintPreview;


    {Avoid the message asking if the workbook should be saved by marking it as already saved. Be careful with this. This step assumes that the workbook does not need to be saved since it is a report template.}

    Workbook.Saved := TRUE;

    {Close Excel}

    XL.Quit;


    END;
Sign In or Register to comment.