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
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
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)).
Identify the URL to run an SSRS report
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.
;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)
;%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
;-- %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
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
Notes
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.