Homepage › Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › How to Generate a Message control ID
- This topic has 8 replies, 6 voices, and was last updated 14 years, 2 months ago by Highland Dave.
-
CreatorTopic
-
January 11, 2008 at 5:43 pm #49742Hongle SunParticipant
Is there any ways to generate a Message Control ID in MSH10 while inbound message hits the interface eninge, the reason is the inbound system doesnot have a msg control id in it? Thanks -
CreatorTopic
-
AuthorReplies
-
-
January 11, 2008 at 7:29 pm #63362Max Drown (Infor)KeymasterHongle Sun wrote:
Is there any ways to generate a Message Control ID in MSH10 while inbound message hits the interface eninge, the reason is the inbound system doesnot have a msg control id in it? Thanks
Here is one way …
Code:
… code …# Get the message ID
set midList [msgmetaget $mh MID]
keylget midList NUM midset msgId $timeStamp$mid
… code …
-- Max Drown (Infor)
-
January 11, 2008 at 8:26 pm #63363Hongle SunParticipant
Thank but how can i incoprate into my xlate? Please explain. thanks gain -
January 11, 2008 at 9:19 pm #63364Max Drown (Infor)Keymaster
Good question. I’m not sure how to get the mh/mid from an xlt fragment; however, you could set it in a pre or post proc using the code above. -- Max Drown (Infor)
-
January 11, 2008 at 9:37 pm #63365Max Drown (Infor)Keymaster
Here is an example post-proc you could try. You’ll need to add the code that actually changes the field in the hl7 message. Code:
######################################################################
# Name: tps_setMsgId
# Purpose:
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (”start”, “run” or “time”)
# MSGID message handle
# ARGS user-supplied arguments:
#
#
# Returns: tps disposition list:
#
#proc tps_setMsgId { args } {
keylget args MODE mode ;# Fetch modeset dispList {} ;# Nothing to return
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mhset messageTs [clock format [clock seconds] -format %Y%m%d%H%M%S]
# Get the Cloverleaf message ID (mid)
set midList [msgmetaget $mh MID]
keylget midList NUM midputs “MSH.10: $mid$messageTs”
lappend dispList “CONTINUE $mh”
}time {
# Timer-based processing
# N.B.: there may or may not be a MSGID key in args
}
shutdown {
# Doing some clean-up work
}
}return $dispList
}-- Max Drown (Infor)
-
January 11, 2008 at 11:08 pm #63366Charlie BursellParticipant
Max: To get MID in Xlate:
set klst [msgmetaget $xlateId MID]
set MID [keylget klst NUM]
But I would use a counter to build a Message Control ID
-
February 24, 2010 at 8:19 pm #63367Steve PringleParticipant
Charlie,
Why use a counter instead of the approach Max proposed?
The engine uses some sort of internal counter for the NUM component of the msgMid, no?
Plus, using a counter implies you have now performed a read/write disk io.
Or maybe you’re thinking of a tcl variable that gets incremented as needed?
Seem more efficient to use Max’s approach.
Curious minds…
thanks,
Steve
-
February 24, 2010 at 9:30 pm #63368James CobaneParticipant
Depending on the receiving system, they may expect a sequential Control ID, or you may want to have a unique counter related to the specific interface. Lots of reasons to do it either way, but the right way is whichever best meets the need… 🙂
Jim Cobane
Henry Ford Health
-
August 4, 2010 at 8:12 pm #63369Highland DaveParticipant
I could not get this to work as
set klst [msgmetaget $xlateId MID]
set MID [keylget klst NUM]
received the following error
[xlt :xlat:ERR /0:initiate_xlate:08/04/2010 15:14:08] [0.0.1083320] Xlate ‘InitiateA30ToCe.xlt’ failed: Tcl callout error
erroCode: NONE
errorInfo:
bad msgId “xpm0”
while executing
“msgmetaget $xlateId MID”
I changed the xlate to use:
set klst [xpmmetaget $xlateId MID]
set MID [keylget klst NUM]
no errors and a display shows:
+++DEBUG the metadata MID value is 1083391
+++DEBUG the metadata MID value is 1083393
+++DEBUG the metadata MID value is 1083395
+++DEBUG the metadata MID value is 1083397
+++DEBUG the metadata MID value is 1083399
+++DEBUG the metadata MID value is 1083401
+++DEBUG the metadata MID value is 1083403
I do not need a sequential value, I just need a unique ID when sending the merge message to GE Centricity Enterprise. So, it’s like the previous post, what works best for the situation and done in the GUI.
-
-
AuthorReplies
- The forum ‘Cloverleaf’ is closed to new topics and replies.