web stats
encoding from xml to hl7 v3 with javascript - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-14-2010, 11:42 AM
buschert buschert is offline
OBX.1 Kenobi
 
Join Date: May 2010
Posts: 26
buschert is on a distinguished road
Default encoding from xml to hl7 v3 with javascript

I have this JS statement.
tmp['PRPM_IN301010']['controlActProcess']['subject']['registrationEvent']['subject1']['healthCareProvider']['id']['validTime']['low'] = msg['Provider_Identifier_Effective_Start_Date'].toString();

I am not getting any value set in the target (tmp) item.
If I set tmp=msg, It displays the contents of the input xml corresponding to msg before the encoded data but no encoding is done.

The template on the destination panel is set to ${message.encodedData}

What have I missed. This should be a basic operation in Mirth.
Reply With Quote
  #2  
Old 09-14-2010, 11:46 AM
buschert buschert is offline
OBX.1 Kenobi
 
Join Date: May 2010
Posts: 26
buschert is on a distinguished road
Default

I have the hl7 v3 message schema in the outbound message template area.
Reply With Quote
  #3  
Old 09-14-2010, 11:47 AM
dans dans is offline
Mirth Employee
 
Join Date: Apr 2007
Location: Irvine, CA
Posts: 590
dans is an unknown quantity at this point
Default

Looks like an issue with namespaces.
Make sure you set your default namespace if you don't want to specify it in your statements:
default xml namespace = "mynamespace";

You can also wildcard your namespaces:
var startDate = msg.*::Provider_Identifier_Effective_Start_Date.to String();
__________________
Daniel Svanstedt
Software Engineer
Mirth Corporation

Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!
Reply With Quote
  #4  
Old 09-14-2010, 11:48 AM
buschert buschert is offline
OBX.1 Kenobi
 
Join Date: May 2010
Posts: 26
buschert is on a distinguished road
Default

I am using
default xml namespace = "urn:hl7-org:v3"; as a default
Reply With Quote
  #5  
Old 09-14-2010, 11:50 AM
buschert buschert is offline
OBX.1 Kenobi
 
Join Date: May 2010
Posts: 26
buschert is on a distinguished road
Default

Quote:
Originally Posted by dans View Post
Looks like an issue with namespaces.
Make sure you set your default namespace if you don't want to specify it in your statements:
default xml namespace = "mynamespace";

You can also wildcard your namespaces:
var startDate = msg.*::Provider_Identifier_Effective_Start_Date.to String();

I have more than one item that is not being set. In that case would it be

msg.*::*;[/QUOTE]
Reply With Quote
  #6  
Old 09-14-2010, 11:51 AM
dans dans is offline
Mirth Employee
 
Join Date: Apr 2007
Location: Irvine, CA
Posts: 590
dans is an unknown quantity at this point
Default

make sure "strip xml namespaces" is unchecked on both inbound and outbound transformer properties.
__________________
Daniel Svanstedt
Software Engineer
Mirth Corporation

Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!
Reply With Quote
  #7  
Old 09-14-2010, 11:54 AM
buschert buschert is offline
OBX.1 Kenobi
 
Join Date: May 2010
Posts: 26
buschert is on a distinguished road
Default

Quote:
Originally Posted by dans View Post
Looks like an issue with namespaces.
Make sure you set your default namespace if you don't want to specify it in your statements:
default xml namespace = "mynamespace";

You can also wildcard your namespaces:
var startDate = msg.*::Provider_Identifier_Effective_Start_Date.to String();
So I would have to create var item name = msg.*:rovider_itemname();
for item item I am encoding in the script
Reply With Quote
  #8  
Old 09-14-2010, 11:55 AM
buschert buschert is offline
OBX.1 Kenobi
 
Join Date: May 2010
Posts: 26
buschert is on a distinguished road
Default

Quote:
Originally Posted by dans View Post
make sure "strip xml namespaces" is unchecked on both inbound and outbound transformer properties.
Yes I have done that.
Reply With Quote
  #9  
Old 09-14-2010, 12:07 PM
dans dans is offline
Mirth Employee
 
Join Date: Apr 2007
Location: Irvine, CA
Posts: 590
dans is an unknown quantity at this point
Default

No, you don't need to create a variable. I was just giving an example. Does both in coming and outgoing message have the same namespace (urn:hl7-org:v3) ?
__________________
Daniel Svanstedt
Software Engineer
Mirth Corporation

Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!
Reply With Quote
  #10  
Old 09-14-2010, 12:10 PM
buschert buschert is offline
OBX.1 Kenobi
 
Join Date: May 2010
Posts: 26
buschert is on a distinguished road
Default

Quote:
Originally Posted by dans View Post
No, you don't need to create a variable. I was just giving an example. Does both in coming and outgoing message have the same namespace (urn:hl7-org:v3) ?
No. incoming is xml from a database query. I have unchecked on both incoming and outgoing the strip namespace box.
I am only using javascript on outgoing.

Maybe I need to specify the same default on the incoming.
Reply With Quote
Reply

Tags
encoding, hl7v3, javascript

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 04:03 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation