I am having an issue with a very long IF statement in a macro and I keep
on getting errors.
IF{/DATA["MED1]"_"."="."!(/DATA["MED2]"_"."="."!(/DATA["MED3]"_"."="."!.
.......
......... (DATA["MED26]"_"."=".") "Y"^/DATA["HMH"];"N"^/DATA["HMH"]}
I cannot keep on adding the 26 checks (checking if the medication
exists) on one line.
So initially I tried to break the line of code with a new line - but
this gives me an invalid termination error.
Then I tried Shift F6 but this amount of checks will exceed the 256
characters limit per line which leads to still broken line code
generating the same error.
Am I missing something or do I have to create many smaller IF statements
that lead to a final aggregate check?
Thanks,
Marc
Marc Benoy RN, MS, MBA
Manager of Clinical Informatics
CHW, AZ - East Valley Market
475 S. Dobson Road
Chandler, AZ 85224
(480)728.3068
Marc....@CHW.edu
IF{/DATA["MED1"]_"."="."!(/DATA["MED2"]_"."=".")!(/DATA["MED3"]_"."="."!
.
.......
......... (DATA["MED26"]_"."=".") "Y"^/DATA["HMH"];"N"^/DATA["HMH"]}
Thanks,
Brian
Hello all,
Thanks,
Marc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email and any files transmitted with it are confidential, and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error contact the Help Desk for Cape Cod Healthcare.
Help...@CapeCodHealth.org
ganesh seshadri, indiana regional
-----Original Message-----
From: meditech-...@mtusers.com
[mailto:meditech-...@mtusers.com]On Behalf Of Benoy, Marc - MGMC
Sent: Tuesday, December 04, 2007 6:33 PM
To: medit...@mtusers.com
Subject: [MEDITECH-L] NPR - Macro: Lengthy IF Statement
John Curtiss
Hutchinson Area Health Care
1095 Highway 15 South
Hutchinson, MN 55350
320-234-4967
320-234-5060 (fax)
jcur...@hahc-mn.org
-----Original Message-----
From: meditech-...@mtusers.com
[mailto:meditech-...@mtusers.com] On Behalf Of Curtiss, John L
Sent: Wednesday, December 05, 2007 8:11 AM
To: Benoy, Marc - MGMC; medit...@mtusers.com
Subject: Re: [MEDITECH-L] NPR - Macro: Lengthy IF Statement
Try something like this instead:
IF{/DATA["MED1]"_"."="." "Y";
/DATA["MED2]"_"."="." "Y";
/DATA["MED3]"_"."="." "Y";
.......
DATA["MED26]"_"."=".") "Y";"N"}^/DATA["HMH"];"N"^/DATA["HMH"]}
This way you don't need to worry about the length. If any statement
evaluates true then a "Y" is returned, if no statements evaluate true,
the "N" evaluates true because its not nil and the "N" is returned.
Or even better yet, put your med list in a group response and then write
an IF statement:
CS:
IF{&(G)GGL["YOURGROUPRESONSENAME]E[THEMEDBEINGEVALUATED]
"Y";"N"}^/DATA["HMH"];"N"^/DATA["HMH"]
(The above is all on line)
Magic:
IF{/GGL["YOURGROUPRESONSENAME]E[THEMEDBEINGEVALUATED]
"Y";"N"}^/DATA["HMH"];"N"^/DATA["HMH"]
If the med is in the group response its true, thus returns a "Y"
otherwise its false and returns a "N".
John Curtiss
Hutchinson Area Health Care
1095 Highway 15 South
Hutchinson, MN 55350
320-234-4967
320-234-5060 (fax)
jcur...@hahc-mn.org
-----Original Message-----
From: meditech-...@mtusers.com
[mailto:meditech-...@mtusers.com] On Behalf Of Benoy, Marc - MGMC
Sent: Tuesday, December 04, 2007 5:33 PM
To: medit...@mtusers.com
Subject: [MEDITECH-L] NPR - Macro: Lengthy IF Statement
CS:
""^XX^OK,DO{XX+1^XX<27 IF{/DATA["MED"_XX] 1^OK,99^XX}},OK
>>> <meditech-...@mtusers.com> 12/05/07 9:10 AM >>>
Try something like this instead:
IF{/DATA["MED1]"_"."="." "Y";
/DATA["MED2]"_"."="." "Y";
/DATA["MED3]"_"."="." "Y";
.........
CS:
Hello all,
........... (DATA["MED26]"_"."=".") "Y"^/DATA["HMH"];"N"^/DATA["HMH"]}
I cannot keep on adding the 26 checks (checking if the medication
exists) on one line.
So initially I tried to break the line of code with a new line - but
this gives me an invalid termination error.
Then I tried Shift F6 but this amount of checks will exceed the 256
characters limit per line which leads to still broken line code
generating the same error.
Am I missing something or do I have to create many smaller IF statements
that lead to a final aggregate check?
Thanks,
Marc
Marc Benoy RN, MS, MBA
Manager of Clinical Informatics
CHW, AZ - East Valley Market
475 S. Dobson Road
Chandler, AZ 85224
(480)728.3068
Marc....@CHW.edu
Disclaimer: The information in this message is confidential. If you are not the intended recipient, do not disclose, copy, or distribute this message, and please immediately contact the sender.
IF{/DATA["MED1]"_"."="."!(/DATA["MED2]"_"."="."!(/DATA["MED3]"_"."="."!.
^^ ERR ^^ ERR
^^ERR
You could do it this way
"N"^/DATA["HMH"],
IF{L(/DATA["MED1"])<1 " Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED2"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED3"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED4"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED5"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED6"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED7"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED8"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED9"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED10"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED11"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED12"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
IF{L(/DATA["MED13"])<1 "Y";/DATA["HMH"]}^/DATA["HMH"],
Ad nausem
Or
""^/CNT,"N"^/DATA["HMH"],
DO{1+/CNT^/CNT<27 IF{L(/DATA["MED"_/CNT])<1
"Y";/DATA["HMH"]}^/DATA["HMH"]},
Gord
Gordon Dowling
gord.d...@hpha.ca
Applications Analyst
Huron Perth Healthcare Alliance
Stratford, ON N5A 2Y6
(519)272-8210 ext2268
I had hoped to copy a couple of standard reports for editing, but the
macros give a translation error. This may be too complicated for anyone
to explain in this forum (or too global due to high number of errors),
but if anyone knows what the error code means and what I should first
look at to address it I would appreciate your help.
Syntax - K[, $K[, F[, V[, O[, X[, $SEG, $DIR - not allowed! (I get
this error on two reports--sounds like nothing is allowed ;)
Thanks for your help,
Jeanette Ahrens, RN
MIS Clinical Support
DeSoto Memorial Hospital
Arcadia, FL
"The information contained in this message may be privileged and/or
confidential and protected from disclosure. If the reader of this
message is not the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this document is strictly
prohibited. If you have received this communication in error, please
notify us immediately by replying to this message and deleting the
material from any computer."
there are alternatives for opens and segs that you may be find in some of the reports posted on this list where the syntax checker is tricked into not recognizing statements as being these commands. in many cases, you can replace these using %Z.rw.fragment() generally at the expense of performance, but without having to game the syntax checker. for npr reports out of meditech data (rather than what you've created in your own segment), the chances are you dont need to use some of the restricted commands such as Free.
"N"^FOUND,
"MED"^SUB,
DO{+/DATA[SUB]^SUB'>"MED26"&(FOUND="N") IF{/DATA[SUB] "Y"^FOUND}},
FOUND^/DATA["HMH"]
The code should be this when checking for NIL:
"N"^FOUND,
"MED"^SUB,
DO{+/DATA[SUB]^SUB'>"MED26"&(FOUND="N") IF{@Not(/DATA[SUB]) "Y"^FOUND}},
FOUND^/DATA["HMH"]
Thank you,
Mitch Lawrence
Lead Applications Analyst
Technical Support - NPR/Automation
CHRISTUS Information Management
*: Mitchell...@CHRISTUSHealth.org
<mailto:Mitchell...@CHRISTUSHealth.org>
Send a "thank you
<http://intranet.christushealth.org/spiritBuck/Default.asp> " to
someone!
________________________________
From: Lawrence, Mitchell
Sent: Tuesday, December 04, 2007 5:54 PM
To: 'Benoy, Marc - MGMC'; medit...@mtusers.com
Subject: RE: [MEDITECH-L] NPR - Macro: Lengthy IF Statement
Why not just do a DO loop instead?
"N"^FOUND,
"MED"^SUB,
DO{/DATA[SUB]^SUB'>"MED26"&(FOUND="N") IF{/DATA[SUB] "Y"^FOUND}},
FOUND^/DATA["HMH"]
This will loop through /DATA["MEDx"] where x = 1 through 26. If any of
them have a value, it will kick out of the loop on the first one it
finds and put a "Y" into /DATA["HMH"].
If you would rather have it check for empty /DATA["MEDx"], then do the
following (your question is contradictory. You are checking for NIL
(/DATA["MED1"]_"."=".") but say you are checking for a value):
DO{/DATA[SUB]^SUB'>"MED26"&(FOUND="N") IF{@Not(/DATA[SUB]) "Y"^FOUND}},
This will kick out of the loop on the first /DATA[SUB] that doesn't have
a value.
Thank you,
Mitch Lawrence
Lead Applications Analyst
Technical Support - NPR/Automation
CHRISTUS Information Management
(tm): Mitchell...@CHRISTUSHealth.org
Send a "thank you" to someone!
-----Original Message-----
From: meditech-...@mtusers.com
[mailto:meditech-...@mtusers.com] On Behalf Of Benoy, Marc - MGMC
Sent: Tuesday, December 04, 2007 5:33 PM
To: medit...@mtusers.com
Subject: [MEDITECH-L] NPR - Macro: Lengthy IF Statement
"N"^FOUND,
"MED"^SUB,
FOUND^/DATA["HMH"]
Thank you,
Mitch Lawrence
Lead Applications Analyst
Technical Support - NPR/Automation
CHRISTUS Information Management
(tm): Mitchell...@CHRISTUSHealth.org
Checking for a value:
"N"^FOUND,
"MED"^SUB,
DO{/DATA[SUB]^SUB'>"MED26" "Y"^FOUND},
FOUND^/DATA["HMH"]
Checking for NIL:
"Y"^FOUND,
"MED"^SUB,
DO{/DATA[SUB]^SUB'>"MED26" "N"^FOUND},
I looked at this and replaced several @KILL commands with your
example. There is at least one that is part of an IF statement, so not
sure how to go about this.
IF{'BCHG @Kill(/MV["D",RB]),@Kill(/MV["D",RB_"*"]),@Sub(1,LCNT)},
""^RB,1}
I am in way over my head here; this may be obvious to you NPR Gurus,
but to us mere mortals it is pretty overwhelming. This is from the
macro of a Meditech standard statement.
Thanks for your help,
Jeanette
>>> "Ganesh Seshadri" <gses...@indianarmc.org> 12/5/2007 10:26:53 AM
IF{'BCHG ""^XX,
DO{>/MV["D",RB,XX]^XX ""^/MV["D",RB,XX]},
DO{>/MV["D",RB_"*",XX]^XX ""^/MV["D",RB_"*",XX]},
@Sub(1,LCNT)},
""^RB,1}
But there's probably going to be more problems with the sytax checker and the copied code. Copyin from the standard to a zcus is usually useful only for the most simple reports. Otherwise, you're better off starting from scratch.
>>> <meditech-...@mtusers.com> 12/05/07 11:38 AM >>>
Hello Ganesh,
Hello,
Thanks for your help,
Disclaimer: The information in this message is confidential. If you are not the intended recipient, do not disclose, copy, or distribute this message, and please immediately contact the sender.
>>> "Robert White" <Whi...@nehealth.com> 12/5/2007 12:30:22 PM >>>