web stats
Help with variable - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-21-2016, 10:11 AM
pmcnally pmcnally is offline
Mirth Newb
 
Join Date: Dec 2015
Location: Massachusetts
Posts: 9
pmcnally is on a distinguished road
Unhappy Help with variable

Hi all,

I need to populate a field in each ORC with a field from the OBR that follows each ORC. This works fine if a single ORC/OBR but if multiple in msg, I am getting the multiple list assignment error.

This is what I originally wrote:

for each(orc in msg.ORC)
{
msg['ORC']['ORC.3']['ORC.3.1'] = msg['OBR']['OBR.3']['OBR.3.1'].toString();
msg['ORC']['ORC.7']['ORC.7.4'] = msg['OBR']['OBR.7']['OBR.7.1'].toString();
msg['ORC']['ORC.9']['ORC.9.1'] = msg['MSH']['MSH.7']['MSH.7.1'].toString();

The message would look like this:
MSH|^~\&||SJ|||201612211325||ORU^R01|59845|D|2.3|| |AL|NE|
PID|1||J0000263|M565|LITICAL^ANA^^^^^L|PHALACTIC|1 9930926|F||B|24PV1|1|O|FDIM|EL|O||^LAUAD^LAUM^ADAM ^J^^1145298737^M.D.|||||||POORC||565.001SJ|||||||| | |^LAUAD^LUAM^ADAM^J^^1145298737^M.D.|
OBR|1|565.001SJ|1093SJ|MM^DIGMS^DIGITAL MAMMO ORC||566.001SJ||||||||| |^LAUAM^LUAM^ADAM^J^^1145298737^M.D.|
OBR|1|566.001SJ|1093SJ|US^BRUNICOM^SONO BREAST OBX|1|TX|||PATIENT: LITICAL,ANA DOB: 09/26/1993 AGE: 23 SEX:F

I think I need to use a variable but am not sure exactly how to write it.
Thanks,
Patti
Reply With Quote
  #2  
Old 12-21-2016, 11:48 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 613
kirbykn2 is on a distinguished road
Default

when there are multiple iterations you need to identify with one you need.

This selects first iteration.
msg['ORC']['ORC.3']['ORC.3.1'] = msg['OBR']['OBR.3']['OBR.3.1'].toString();
msg['ORC']['ORC.7']['ORC.7.4'] = msg['OBR'][0]['OBR.7']['OBR.7.1'].toString();
msg['ORC']['ORC.9']['ORC.9.1'] = msg['MSH']['MSH.7']['MSH.7.1'].toString();

This selects the second.

msg['ORC']['ORC.3']['ORC.3.1'] = msg['OBR']['OBR.3']['OBR.3.1'].toString();
msg['ORC']['ORC.7']['ORC.7.4'] = msg['OBR'][1]['OBR.7']['OBR.7.1'].toString();
msg['ORC']['ORC.9']['ORC.9.1'] = msg['MSH']['MSH.7']['MSH.7.1'].toString();
__________________
Best,

Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.4
Mirth Connect Version 3.8.0
Java Version 1.6.0_45-b06
Java (64 bit) Version 1.6.0_45-b06
Java 7 (64 bit) Version 1.7.0_151-b15
Java 8 (64 bit) Version 1.8.0_181-b13
PostgreSQL Version 9.6.8
Reply With Quote
  #3  
Old 12-22-2016, 03:33 AM
pmcnally pmcnally is offline
Mirth Newb
 
Join Date: Dec 2015
Location: Massachusetts
Posts: 9
pmcnally is on a distinguished road
Default Thank you!

Thank you. I found another way but your way looks much easier so will use next time.
~Patti
Reply With Quote
Reply

Tags
multiple orc, variable

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 08:03 AM.


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