I have numerous summary reports (data displayed from TK1 or TK2) that offer
the user a choice of displaying the detail data. If the answer to the page
#2 prompt xx.details is "Y" I display the detail line via LC=IF{
c.xx.details="Y" 1;""}, and any explanitory header lines as necessary. I
also have seperate exports of the same report (detail line only) that has
all the proper export settings to make it a comma delimetted, quoted text
file.
I would like to combine the functionality of "Report or Export" into one NPR
report. The report will be laid out to produce a conventional paper report
but will prompt the user to specify which incantation he would like, at run
time. If "report" is selected, the report runs normal. If "Export" is
selected all necessary parameters would be set "on the fly"; like SFF NO,
EFF NO, FD 44, lines/per/page equal to page size, and page banner set to
NONE.
Does anyone know how to set these parameters at run time in order to produce
the proper export?
Thank you. Ron :-)
--
Ron Archambault
NPR Report & Database Developer
Wing Memorial Hospital
40 Wright St.
Palmer, MA 01069
413-284-5511
Ronald.Ar...@umassmemorial.org
Testing for the /.PRT variable works well. Here is a simple sample based on
your logic. It assumes that four fields are being exported
(@account.number, @adm.date, @dis.date, @name, including 4 header labels.
The export will be quoted text, comma delimited, suitable for an Excel
"Import Delimited Data". D(44) is the comma designator, D(34) is the
quotation mark designator.
AL START start
IF{/.PRT="DOWNLOAD" @DOWNLOAD,@OUTPUT}
DOWNLOAD
1^/DWN^/R.FOUND^/R.PAGE.NO,
"ACCT#"^ZZ,@LOG,
"ADM.DATE"^ZZ,@LOG,
"DIS.DATE"^ZZ,@LOG,
"NAME"^ZZ,@LOG
LOG
/OUT_D(44)_D(34)_ZZ_D(34)^/OUT,
""^ZZ
OUTPUT
/OUT%0^!,
D(13,10)^!,
""^/OUT
AL D detail (assumming that the detail line exists on page 3 and that it's
the first field, /V[1], /V[2], etc. works. If the detail line does not
exist, then substitute with @account.number, @adm.date, etc.)
IF{/.PRT="DOWNLOAD" @DOWNLOAD,@OUTPUT}
DOWNLOAD
/V[1]^ZZ,@LOG,
%Z.date.out(/V[2])^ZZ,@LOG,
%Z.date.out(/V[3])^ZZ,@LOG,
/V[4]^ZZ,@LOG
LOG
/OUT_D(44)_D(34)_ZZ_D(34)^/OUT,
""^ZZ
OUTPUT
/OUT%0^!,
D(13,10)^!,
""^/OUT
/OUT is the string of data that is exported. It will have a leading comma,
hence the need for %0 to strip it.
Thanks for your help.
Ron :-)
---------- Forwarded message ----------
From: Blount, Mark <Mark....@waynehealth.org>
Date: Apr 1, 2008 3:47 PM
Subject: RE: NPR Report to on-the-fly Export
To: Ron Archambault <ronar...@gmail.com>
MAGIC 5.61
Hiya, Ron,
I've done something similar using 1) a conditional LCR on page 3 to
suppress all of the printable output ( including the Header Page lines )
should the user pick "DOWNLOAD" at the "Print on" prompt ( or my spool
group mnemonic if I'm doing it )....
Page 3
Editing Picture - <ESC> for Fields or Region
REG A 0---------1---------2---------3--
HP B WAYNE MEMORIAL HOSPITAL (<------Line check range starts
LCR='/DWN)
HP xx.user
HP BAR.PAT
HP *
HP +
HP NUMBER NAME
HP *
D * *number______ name_______________ (---> other fields on the
picture)
D
D E 1 (<-------------Line check range ends
LCR=END)
2) An AL START macro that outputs "header" fields if the flag is set
with a couple lines to set some Meditech variables..
IF{/.PRT="DOWNLOAD" 1^/DWN,1^/R.FOUND,1^/R.PAGE.NO},
IF{/.PRT="RW" 1^/DWN,1^/R.FOUND,1^/R.PAGE.NO},
Stuff done in between.....
And here it starts sending header fields after checking the variable..
IF{/DWN %Z.date.out(b.txn.ser.date)_" -
"_%Z.date.out(e.txn.ser.date)_D(13,10)^!,
"Run Date:"_%Z.date.out(@.today)_" "_@.now_"
"_@.user_D(13,10)^!,
D(13,10)^!,
"MLTPL BD XFER"_D(9)^!,
"NUMBER"_D(9)^!,
"NAME"_D(9)^!,
"ADM DT"_D(9)^!,
"DIS DT"_D(9)^!,
"WRITE OFF DATE"_D(9)^!,
........
........
D(13,10) is a carriage return and line feed - since you'll have to make
that happen yourself...
3) In the detail macro..you'll have to define your own delimiter or
fixed length condition. Tab delimited in my case D(9).
The download option requires a detail macro ( or at some region level )
with output lines that run if the value of a variable is set...
IF{/DWN @DOWNLOAD.LINE}
...
...
...
DOWNLOAD.LINE
IF{FLAG>1
"*"}_D(9)_@number_D(9)_@name_D(9)_%Z.date.out(@adm.date)_D(9)^!,
%Z.date.out(@bar.dis.ser)_D(9)_%Z.date.out(@bd.age.date)_D(9)^!,
WRITEOFF_D(9)_%Z.date.out(FSDT)_D(9)_/INS[account]_D(9)_HICNUM_D(9)_MDNU
M_D(9)^!,
@ins.rcpt["MEDCD"]_D(9)_POSTBD_D(9)^!,
So it's really not a matter of conditionally setting parameters in a
footnote - I don't even know if you can or that I've ever been
taught....it's you building the routine so it'll do it your way, I'm
thinking. I think I did a bunch of diddling / testing before it all
worked out. But it can be run by the user to print or download output.
I almost believe I stole code parts from two "Joe Magic Guru" routines
and slapped them together (a nice printable one and a nice download
one)...adding the conditional options...
I don't know how helpful this is...I'm not much more than a novice
myself...and sometimes I create some clunky stuff....
Mark Blount
Programmer Analyst, Information Technology
Wayne Memorial Hospital
Goldsboro, NC
919.731.6588
www.waynehealth.org
"God who gave us life gave us liberty. Can the liberties of a nation be
secure when we have removed a conviction that these liberties are the
gift of God? Indeed I tremble for my country when I reflect that God is
just, that his justice cannot sleep forever." Thomas Jefferson
-----Original Message-----
Hi All,
Ron Archambault