web stats
Iteration from ~ to new line - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 06-19-2019, 07:48 PM
Golfmachine Golfmachine is offline
Mirth Newb
Join Date: Jun 2019
Posts: 13
Golfmachine is on a distinguished road
Default Iteration from ~ to new line

Hi! I'm fairly new to Mirth but have been able to use it quite successfully. I currently have an OBR line as such:

OBR|1|LB00000022||FE^Fe(TIBC)~FECAL^FECALYSIS~URIN ES^URINALYSIS (HMO)~CBCP^CBC PLATELET|R|20190614142600||||||||||^|OPD^|LB|OPD^| 3654335~3654336~3654337~3654338||||||||||

I plan on making it so instead of ~ separating the various OBR4 and OBR20, they will make new OBRs like so:
OBR|1|LB00000022||FE^Fe(TIBC)|R|20190614142600|||| ||||||^|OPD^|LB|OPD^|3654335||||||||||
OBR|2|LB00000022||FECAL^FECALYSIS|R|20190614142600 ||||||||||^|OPD^|LB|OPD^|3654336||||||||||
OBR|3|LB00000022||URINES^URINALYSIS (HMO)|R|20190614142600||||||||||^|OPD^|LB|OPD^|365 4337||||||||||
OBR|4|LB00000022||CBCP^CBC PLATELET|R|20190614142600||||||||||^|OPD^|LB|OPD^| 3654338||||||||||

I'm sure this should be a fairly easy thing to do but I am finding it hard to look for a javascript that will help iterate this. Scoured the forums and all I was able to find was a code similar to this:

for each (obr4 in msg.PID['OBR.4']) {

Not sure where to go from there honestly.

Thank you all in advance!

P.S. I may also need to figure out how to make OBR1 change numbers depending on line number. By that I mean line 1 its value = 1, line 2 value =2, etc. It's actually not as big a priority as iterating ~ to new lines though hehe
Reply With Quote

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 07:02 PM.

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