Homepage › Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Question on Regular Expression routing
- This topic has 12 replies, 8 voices, and was last updated 7 years, 9 months ago by Peter Heggie.
-
CreatorTopic
-
December 19, 2005 at 6:20 pm #48212Rentian HuangParticipant
Greetings Cloverleafers!!! I am trying to route A01,02,03,06,07,08,11,13,17 with the below regular expression, with “Wild Card Route” unchecked. Doesn’t work…
Code:ADT_A(0[1-3])|(0[6-8])|11|13|17
I tried check the “Wild Card Route” also, but it doesn’t work neither.
Can someone help?
Thanks,
Sam 8)
-
CreatorTopic
-
AuthorReplies
-
-
December 19, 2005 at 6:37 pm #58015David GordonParticipant
edit: Sorry, I thought I saw something, but I was mistaken… -
December 19, 2005 at 7:42 pm #58016Charlie BursellParticipant
The Wildcard must be checked for regular expressions to work. The regular expression is applied to the TRXID only. Make sure you have selected to route an HL7 message so that it is parsing the message for the message type and applying the regular expression against that.
The regular expression looks OK to me but could be simplified a bit
ADT_A(0[1-36-8])|(1[137])
-
December 19, 2005 at 9:42 pm #58017Rick BrownParticipant
I did a search on the word “wildcard” and the info in the thread below turned up. -
December 19, 2005 at 10:05 pm #58018Rentian HuangParticipant
Just FYI.. I was having error with ADT_A(0[1-36-8])|(1[137]), but the following does whatever I need: ADT_A(0[1-36-8]|(1[1237])), with the “Wild Card Route” checked, of course.
Thanks Charlie and Rick!
Sam 😀
-
August 20, 2009 at 6:10 pm #58019Troy MortonParticipant
Possibly your first example
Code: ADT_A(0[1-3])|(0[6-8])|11|13|17
was erroring because the entire regular expression is not in parenthesis (). You have |11|13|17 hanging outside the parenthesis.
I think this could have been corrected by simply adding another set of parenthesis around the whole thing like so:
ADT_A((0[1-3])|(0[6-8])|11|13|17)
Cheers
-
August 20, 2009 at 6:30 pm #58020Troy MortonParticipant
This link no longer works:
<a href="http://clovertech.infor.com/viewtopic.php?t=488&highlight=wildcard” class=”bbcode_url”>http://clovertech.infor.com/viewtopic.php?t=488&highlight=wildcard -
August 20, 2009 at 8:08 pm #58021Max Drown (Infor)KeymasterTroy Morton wrote:
This link no longer works:
<a href="http://clovertech.infor.com/viewtopic.php?t=488&highlight=wildcard” class=”bbcode_url”>http://clovertech.infor.com/viewtopic.php?t=488&highlight=wildcardhttp://clovertech.infor.com/viewtopic.php?t=488&highlight=wildcard
-- Max Drown (Infor)
-
August 21, 2009 at 12:00 pm #58022Gary AtkinsonParticipant
Use this:
Code:ADT.A(01|02|03|06|07|08|11|13|17)
-
December 17, 2016 at 3:27 pm #58023Peter HeggieParticipant
I’m thinking of using a regular expression in a route specification, not for HL7 but for file routing. I’m wondering if this is a bad idea.
I have a source FTP thread that picks up multiple files several times a day. There are seven different destination threads which will receive the files/messages based on the file name. The file names are all fixed length and have a naming standard that designates the type of file, the facility they belong to, if they are for physician billing etc.
Currently we use logic in a pre-translate filter to read DRIVERCTL to get the file name and then parse the components of the file name and KILL or CONTINUE the message based on the requirements for that destination.
it occurs to me that I could use a TRXID tcl to return just the file name, and then use a regular expression in the route specification. Seems a lot simpler, smaller code, and an administrator can just look at the route specification to know what the requirements are for each route, instead of opening up each filter tcl to find out how that destination is being determined.
Does this make sense?
Here is an example of a regular expression (I am not very good with it but this one seems to work):
^835.{6}01.*.08430.*
it is an 835 file (starts with 835), from SSI, and then six characters later I’m looking for ’01’ (billing type?) and then after that, one of the nodes (separated by periods) (the hospital facility id) is equal to ‘08430’.
Peter Heggie
-
December 18, 2016 at 1:18 am #58024Charlie BursellParticipant
The regular expression used to route a message is applied to a portion of the message itself not the file name. Unless the file type is embedded in the message somewhere I don’t see how you would use regular expression wildcard routing.
You could use a TRXID proc and extract the file name from metadata and route it that way
-
December 19, 2016 at 1:39 pm #58025Peter HeggieParticipant
I’m going to try that – thank you – let you know.
Peter Heggie
-
December 20, 2016 at 2:15 pm #58026Peter HeggieParticipant
That worked – thank you
This is the trxid proc:
Code:proc trxidFileName { msgId } {
set msg [msgget $msgId]set debug 1
set module “trxidFileName”
if {$debug > 2} {echo “$module msg: $msg”}# Get the metadata portion that contains the inbound filename with directory path.
set driverctl [msgmetaget $msgId DRIVERCTL]
if {$debug > 1} {echo “$module input file path key: $driverctl”}# If the output file name is already set, use that name, else use default input file name
set obfilepos [string first “OBFILE” “$driverctl”]
if {$obfilepos > -1} {
set result [keylget driverctl FILESET.OBFILE filename]
} else {
set result [keylget driverctl FILENAME filename]
}
if {$debug > 1} {echo “$module keylget filename result: $result filename: $filename”}# check for error getting the filename from DRIVERCTL – set trxid to error text for visibility in process log
if {$result eq 0} {
echo “$module ERROR – unable to keylget filename from DRIVERCTL $driverctl”
return “ERROR_filename”
}set basename [file tail “$filename”]
if {$debug > 1} {echo “$module input file name: $basename”}set trxid “$basename”
if {$debug} {echo “$module trxid: $trxid”}return $trxid
}I have attached a picture of the routing.
I’m trying to strike a balance between a clever solution that requires no dynamic routing logic in each pre-translate proc (andwhich is also ‘self-explanatory’ in the routing syntax), and a ‘normal’ solution that requires only a basic understanding of Cloverleaf filtering in tcl.
Peter Heggie
-
-
AuthorReplies
- The forum ‘Cloverleaf’ is closed to new topics and replies.