web stats
DG1 delete one segment - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-01-2015, 07:30 AM
kab7715 kab7715 is offline
OBX.1 Kenobi
 
Join Date: Aug 2015
Posts: 47
kab7715 is on a distinguished road
Default DG1 delete one segment

I'm trying to delete a DG1 segment when the value in DG1.3.1 equals 0. I don't know what mistake I'm missing because I cant seem to get the last row in this message to be deleted. Mirth version 3.3.0.7801

DG1|1||182.0^MALIG NEO CORPUS UTERI^I9|||Other||||||||32|
DG1|2||197.0^SECONDARY MALIG NEO LUNG^I9|||Other||||||||32|
DG1|3||573.8^LIVER DISORDERS NEC^I9|||Other||||||||32|
DG1|4||429.3^CARDIOMEGALY^I9|||Other||||||||32|
DG1|5||V88.01^ACQUIRED ABSENCE OF BOTH CERVIX AND
DG1|6||V87.41^PERSONAL HISTORY OF ANTINEOPLASTIC
DG1|7||0^HX OF IRRADIATION^I9|||Other||||||||32|

I'm using the following code in the transformer, I've tried different variations but this is the current one in channel transformer step.

for each(dg1 in msg..DG1)
{
for each(code in dg1['DG1.3']['DG1.3.1'])
{
if(code.toString() == '0')
{
delete dg1['DG1'];
}
}
}

i've also used.

for each(dg1 in msg.DG1)
{
if(dg1['DG1.3']['DG1.3.1].toString() == '0')
{
delete msg[dg1];
}
}

message still appears after reprocessing and looking at encoded results

Last edited by kab7715; 12-01-2015 at 08:19 AM.
Reply With Quote
  #2  
Old 12-03-2015, 03:50 AM
mcalKno mcalKno is offline
 
Join Date: Apr 2015
Location: Pennsylvania
Posts: 247
mcalKno is on a distinguished road
Default

Code:
for each(dg1 in msg.DG1)
{
    if(dg1['DG1.3']['DG1.3.1'].toString() == '0')
    {
        delete (msg.children()[dg1.childIndex()]);
    }
}
Reply With Quote
  #3  
Old 12-14-2015, 08:51 AM
kab7715 kab7715 is offline
OBX.1 Kenobi
 
Join Date: Aug 2015
Posts: 47
kab7715 is on a distinguished road
Default

Quote:
Originally Posted by mcalKno View Post
Code:
for each(dg1 in msg.DG1)
{
    if(dg1['DG1.3']['DG1.3.1'].toString() == '0')
    {
        delete (msg.children()[dg1.childIndex()]);
    }
}
Thank you for the help, worked perfectly
Reply With Quote
Reply

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 05:30 AM.


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