Blogs Home
Thursday, April 23, 2015 1:24 PM

DR+NPR Tip: Running Web-based Reports from a MEDITECH Menu

Written by Thomas Harlan, Jim McGrath; Reporting Services Team - iatricSystems

with Mitchell Lawrence, HIS Programmer Analyst at Iatric Systems

Overview

Many sites using SQL Server Reporting Services will use the External Links feature in MEDITECH to route a user to the "top" of the reporting portal. However, you can also set up a structure in NPR that lets you invoke the user’s web browser and provide a URL to go to the reporting portal and open a specific report directly from a MEDITECH menu.

Overview

Many sites using SQL Server Reporting Services will use the External Links feature in MEDITECH to route a user to the "top" of the reporting portal. However, you can also set up a structure in NPR that lets you invoke the user’s web browser and provide a URL to go to the reporting portal and open a specific report directly from a MEDITECH menu.

We do this by creating two NPRs (which are attached to this tip in both MAGIC (PDF) and C/S (PDF) versions):

First, there we’ll call the control report:

MIS.USER.zcus.is.rs

This single NPR holds a list of all web-based report URLs you want to invoke from a MEDITECH menu, and each one of them is assigned a unique identifying number. (If you’re using Data Request Numbers (tip from 2/19/2015), then you can use the same number here).

Example Report URLs

Business Objects http://boe.hospital.org:8080/BOE/OpenDocument/opendoc
/openDocument.jsp?sIDType=CUID&iDocID=ASiVWPaLWtJNmPHJIu87i2Y
MS Reporting Services http://rs.hospital.org/Reports/Pages/Report.aspx?
ItemPath=%2fEDM_zcus_iatric_ed_dashboard

Second, we have a stub or template NPR that exists only to be copied into a version that you’ll update to point to the web-portal-based report:

MIS.USER.zcus.is.rs.template

This gets copied to something like:

EDM.PAT.zcus.is.rs.ed.dashboard

Within that copy of the template (what we’ll call the link report) all we need to do is update the Title field (on Page 1) to reference the number we assigned to the URL that we want to kick off:

"_MIS.USER.zcus.is.rs.M.launch(1)_"

The launch macro over in zcus.is.rs then builds out the URL we want and launches the default browser on the workstation and goes to that URL, viewing the report.

Once that is set up, then you can attach EDM.PAT.zcus.is.rs.ed.dashboard to any MT menu that will accept an NPR as a menu option, and then launch the web-portal-based report from inside a MEDITECH workflow.

All of the report URLs are centrally managed in MIS.USER.zcus.is.rs so they are easy to find, update and add to.

Requirements

  1. Each MEDITECH (MT) workstation needs a web-browser installed and set to handle http requests by default.
  2. Preferably, access to your web-reporting portal will be handled by Single Sign On, using the end user’s Active Directory credentials – so that they open the reporting portal web-page seamlessly without being prompted for a username and password.
  3. Users launching the reports from a MEDITECH menu will need at least * access to the appropriate application in the MIS user dictionary where the link report is created.
  4. Users will of course need appropriate access to the reporting server and the specified report they are running.

Creating MIS.USER.zcus.is.rs.template from scratch

This is the template report that the end user copies and then modifies the title field to call the proper report. This is also provided via an attachment to this tip (MAGIC (PDF) or Client/Server (PDF)).

  1. Start NPR
  2. Create a new NPR in MIS.USER called zcus.is.rs.template
  3. Edit the report
  4. Set the title to "_%MIS.USER.zcus.is.rs.M.launch(1)_"
  5. Set Detail to N
  6. File and Translate the report

Identify the URL to run an SSRS report

  1. Go to the MS Reporting Services portal and right-click on a report name in Report Manager. Copy the URL to clipboard, and you should get a URL like this:
    http://reportsvr/Reports/Pages/Report.aspx?
    ItemPath=%2fEDM_zcus_iatric_ed_dashboard
  2. For long URLs, it is best to break up the url at a punctuation into smaller parts to avoid character limits:

    http:// PREFIX
    reportsvr RSSERVER
    /Reports/Pages/Report.aspx?ItemPath=%2f PATHTOREPORT(1)
    EDM_zcus_iatric_ed_dashboard REPORT(1)

Create the Launch report from scratch

This NPR holds the code to produce our report based on the parameter fed to M.launch.

  1. Start NPR
  2. Create a new NPR in MIS.USER called zcus.is.rs
  3. Edit the report
  4. Set the title to Reporting Services Utilities
  5. Set Detail to N
  6. File and Translate the report
  7. Create a new macro called "launch"
  8. Enter the following into the macro code
    For C/S:

    ;C/S title code: "_%(MIS)USER..zcus.is.rs.M.launch(URLSEQ)_"
    IF{'/DONE @SET.VARIABLES,
    @GET.URL,
    @CALL.URL,
    1^/DONE},
    /R.TITLE;

    SET.VARIABLES
    ;Set the URLSEQ
    A^URLSEQ,
    ;Suppress Print On Prompt and End of Report messages
    1^/Z.SCHED.LOG^/R.NO.PRT.MSGS,
    END

    CALL.URL
    @CS.CALL.URL,
    END

    GET.URL
    %MIS.USER.zcus.is.rs.M.url(URLSEQ),
    END

    CS.CALL.URL
    @Shell.execute(/FULLURL)

    For MAGIC:

    ;MAGIC title code: "_%MIS.USER.zcus.is.rs.M.launch(URLSEQ)_"
    IF{'/DONE @SET.VARIABLES,
    @GET.URL,
    @CALL.URL,
    1^/DONE},
    /R.TITLE;

    SET.VARIABLES
    ;Set the URLSEQ
    A^URLSEQ,
    ;Suppress Print On Prompt and End of Report messages
    1^/Z.SCHED.LOG^/R.NO.PRT.MSGS,
    END

    CALL.URL
    @MAGIC.CALL.URL,
    END

    GET.URL
    %MIS.USER.zcus.is.rs.M.url(URLSEQ),
    END

    MAGIC.CALL.URL
    %Z.link.to.shell("","",^/URL)

  9. File and translate your macro
  10. Create a new macro called "url"
  11. Enter the following into the macro code for C/S and MAGIC both:

    ;%MIS.USER.zcus.is.rs.M.url(URLSEQ)
    @SET.VARIABLES,
    @BUILD.URL,
    END;

    SET.VARIABLES
    A^URLSEQ,
    ""^SEQ,
    ;Get Global Variables
    %MIS.USER.zcus.is.rs.M.config(""),
    /PREFIX_/RSSERVER^/URL[@Add(1,SEQ)],
    ""^RSEQ,
    DO{+/PATHTOREPORT[RSEQ]^RSEQ /PATHTOREPORT[RSEQ]^/URL[@Add(1,SEQ)]},
    /REPORT[URLSEQ]^/URL[@Add(1,SEQ)],
    END

    BUILD.URL
    ;Build Final URL from Sequenced Path
    ""^SEQ,
    DO{+(/URL[SEQ],DATA)^SEQ @Add(L(DATA),TOT)},
    TOT^/URL|0,
    END

  12. File and translate your macro
  13. Create a new macro called "config"
  14. Enter the following into the macro code for C/S and MAGIC both (NOTE: this is where the customer will need to do the most customization, see comment lines in green):

    ;-- %MIS.USER.zcus.is.rs.M.config("")
    @SET.VARIABLES,
    @BUILD.REPORT.ARRAY,
    END;

    SET.VARIABLES
    ;-- Set /RSSERVER to the DNS name for your reporting server. This will be used to
    ;-- dynamically build the URL to launch the reports.
    ;
    "REPORTSVR"^/RSSERVER,
    ;
    ;
    ;-- Set /PREFIX to "https://" or "http://", depending on your report server environment
    ;
    "http://"^/PREFIX,
    ;
    ;
    ;-- Set the /PATHTOREPORT, Note, if this is exceedingly long, you may need to use more
    ;-- than one array element
    ;
    ""^SEQ,
    "/Reports/Pages/Report.aspx?ItemPath=%2f"^/PATHTOREPORT[@Add(1,SEQ)],
    END

    BUILD.REPORT.ARRAY
    ;-- ED Dashboard
    ;
    "ED Dashboard"^/R.TITLE[1],
    "EDM_zcus_iatric_ed_dashboard"^/REPORT[1],
    ;-- Pledge Form Download
    ;
    "Pledge Form Download"^/R.TITLE[220],
    "PledgeFormDownload"^/REPORT[220],
    END

  15. File and translate your macro

NOTE: Customization by the customer for their environment is mostly done in the M.config macro, with the exception of copying and modifying the stub report for each individual SSRS report being ran.

Using template NPR to create stub reports for your SSRS reports

  1. Copy MIS.USER.zcus.is.rs.template to a unique name that identifies the report you are wanting to run out of SSRS, for example: MIS.USER.zcus.is.rs.ed.dashboard.
  2. Identify the ID number of the report to invoke. "1" in our example.
  3. In the new NPR, modify the title field to read
    1. For C/S: "_%(MIS)USER..zcus.is.rs.M..launch(1)_"
    2. For MAGIC: "_%MIS.USER.zcus.is.rs.M.launch(1)_"
  4. File and translate the new NPR
  5. Attach new NPR to user’s menu, which will allow them to run the SSRS report EDM_zcus_iatric_ed_dashboard from the Reporting Services server in their default web browser.
  6. Attach EDM.PAT.zcus.is.rs.ed.dashboard to user’s menus and they will now be able to execute the ED dashboard SSRS report from within MEDITECH.

Notes

  1. In this example we used MIS.USER as the template report DPM because MIS reports exist on every MAGIC segment. However both the template and the shell reports can be created in any DPM.
  2. MAGIC has a maximum line size of 250 characters. In practice, lines should not exceed 200 characters to leave room for overhead. Very long SSRS report paths can be broken into shorter segments and loaded into additional lines in the /URL array, as shown.

Extra Credit

★ Modify the control NPR (zcus.is.rs) to list the contents of the URL array in the Detail section of that report– then you can run that report and get immediate documentation of everything you have set up.

★ Make a variant of the zcus.is.rs and zcus.is.rs.template structure to run from a specific DPM (like BAR.PAT) – prompt for an account number using the MT prompt screen(s) – and then invoke an SSRS or Crystal Report passing that account number as a parameter: (Passing Parameters by URL for SSRS | Passing Parameters by URL for Business Objects ).

Visit our report library at http://www.iatric.com/Information/NPRReportLibrarySearch.aspx.

You can find additional Report Writing Tips on our website at http://www.iatric.com/Information/NPRTips.aspx, as well as information about our on-site Report Writer Training and Report Writing Services.

To subscribe for email notifications for new Report Writing classes, please follow this link:

http://www.iatric.com/Information/Classes.aspx.

For more information, please contact Karen Roemer at 978.805.3142 or email or our NPR report writing team at reportwriting@iatric.com.