Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CASE syntax 1

Status
Not open for further replies.

Geates

Programmer
Aug 25, 2009
1,566
0
0
US
I'm getting "Parm1 : Test must be a function call or variable name". Isn't this how I refer to a variable from the source structure?

Code:
(case ([red]~input%SDC_ADT.MSH.MSH-9-message_type.MSH-9-2_trigger_event[/red])
   (("A01" "A04" "A05" "A08" "A13")
      (not-verify ~input%SDC_ADT.PV1.PV1-3-assigned_patient_location.PL.point_of_care/nu "MH")
   )
   (("A02")
      (not-verify ~input%SDC_ADT.PV1.PV1-3-assigned_patient_location.PL "OR\|L1\|NS")
   )
)

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Even though that seems like a variable to me, I decided to redundantly put it through a string function. It works fine now.

Code:
(case ([red]subseq[/red] ~input%SDC_ADT.MSH.MSH-9-message_type.MSH-9-2_trigger_event [red]0 3[/red])

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
You could also have tried:

(string->symbol ~input%SDC_ADT.MSH.MSH-9-message_type.MSH-9-2_trigger_event)

and that would have done the trick.

rxp.
 
string->symbol Syntax
(string->symbol string)

Description
Creates a symbol from the specified string.

Return Value
symbol
A symbol created from the specified string.

Examples
(string->symbol "mISSISSIppi") => mISSISSIppi
(symbol?(string->symbol "mISSISSIppi")) => #t

The Monk reference on this function isn't very helpful. What is a "symbol"

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Think of the 'Conversion Procedures' (Chapter 11) as a way to more accurately test/validate your logic, depending on what you are testing.

string->symbol
For CASE statements, it assigns the value of the specified string to the 'symbol'. The symbol is then tested. The symbol may contain alphanumeric characters.
-If you don't convert, and your string contains a number, you may get an error.

char->number
In this case you can test for less than, greater than, equal to. For example, in HL7, the date comes in as YYYYMMDD. You can test for a specific date, after a specific date, between a date. etc.
-If you don't convert, and your char is not a number, you may get an error.

There are other conversions listed. You need to be aware of all the possible types of data/characters you will be testing. This will determine which one of the conversion procedures better fits your needs.
 
Because ADT Types almost always contain numbers and errors may occur from CASEing alphanumberic expressions, I'll have to investigate my logic further. Thanks for bring it to my attention.

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top