web stats
Help with String Contains - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 05-17-2019, 05:44 AM
pmcnally pmcnally is offline
Mirth Newb
Join Date: Dec 2015
Location: Massachusetts
Posts: 9
pmcnally is on a distinguished road
Unhappy Help with String Contains

Novice so while I appreciate any response, something dumbed down would be better for me.

We are pulling Working DRG HL7 messages (BAR-P01). ZRG.4 may say several things. Medicare V.36, APR (all versions) V.36 or Rhode Island Mcd APR V.34 have all come so far. These version numbers will change yearly so I would like to search on 'Medicare' only and 'APR' only.

I tried this:
for each (zrg in msg.ZRG)
if ((zrg['ZRG.4']['ZRG.4.1'].toString().indexOf('Medicare') != -1))
zrg['ZRG.1']['ZRG.1.1'] = msg['ZRG']['ZRG.2']['ZRG.2.1'].toString();
zrg['ZRG.2']['ZRG.2.1'] = 'W';

AND I tried this (among a hundred other things)
if ((msg['ZRG'][0]['ZRG.4']['ZRG.4.1'].toString().indexOf('Medicare') != -1))
msg['ZRG'][0]['ZRG.1']['ZRG.1.1'] = msg['ZRG'][0]['ZRG.2']['ZRG.2.1'].toString();
msg['ZRG'][0]['ZRG.2']['ZRG.2.1'] = 'W';

else if ((msg['ZRG'][0]['ZRG.4']['ZRG.4.1'].toString().indexOf('APR') != -1))
msg['ZRG'][0]['ZRG.1']['ZRG.1.1'] = msg['ZRG'][0]['ZRG.2']['ZRG.2.1'].toString();
msg['ZRG'][0]['ZRG.2']['ZRG.2.1'] = 'W';
msg['ZRG'][0]['ZRG.3']['ZRG.3.1'] = '2019';


but am getting nothing.
Any suggestions?
Thanks, Patti
Reply With Quote
Old 05-17-2019, 09:11 AM
Brad_AZ Brad_AZ is offline
Mirth Newb
Join Date: Mar 2018
Location: Arizona, USA
Posts: 23
Brad_AZ is on a distinguished road

Hi Patti,

What do you mean by getting nothing?

Here's what I see using your 2nd block of code:

ZRG|1|2|3|Medicare V 36, XXX|

is transformed to

ZRG|2|W|3|Medicare V 36, XXX|
ZRG|1|2|3|XXXX V 36, APR|

is transformed to

ZRG|2|W|2019|XXXX V 36, APR|
ZRG|1|2|3|XXXX V 36, XXX|

is not transformed

Seems to be doing what you are asking... Can you post a full sample of your source message?
SIG|1|Brad|Mirth Certified Interface Analyst^Cancer Treatment Centers of America

Last edited by Brad_AZ; 05-17-2019 at 09:19 AM.
Reply With Quote

string contains

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 12:38 PM.

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