Combining Multiple NPR Fields into One Field
Have you ever had a vendor request a list of NPR fields as 1 field? A teammate of mine did and here's how you can do it:
VAL = (@location:0XS)_(@room:0XS)_(@bed:0XS)
:0XS is actually 2 steps. The :0X will remove characters outside the printable range. Characters outside the printable range look like a space when printed. ASCII Characters 33 - 126 are printable characters. The :0X removes 0 - 31, 127 - 255. Next the S portion strips the remaining spaces; as you know 32 is the code for a space.
The :0XS is a bit of overkill; but I expect invisible characters and spaces and then I'm never disappointed.
Lets assume these values:
@location = "HMD"
@room = "101"
@bed = "B"
The VAL statement above will print like this:
"HMD101B"
Combining these fields can be a preferred way to store location room and bed in a system outside of MEDITECH where they don't have to keep track of all room/bed details like MEDITECH does. Its definitely not 3NF; but suitable for reporting purposes & analysis.

0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home