web stats
loop through FT1 Segments - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-23-2011, 03:16 AM
Erik Erik is offline
Mirth Newb
 
Join Date: Sep 2011
Location: the Netherlands
Posts: 9
Erik is on a distinguished road
Default loop through FT1 Segments

I want to update the Transaction Id in the FT1 segments of a DFT message.
I have a script as follows

for(var i=0;i<msg.children().length();i++){
var curSeg = msg.children()[i];
if(curSeg.name() == "FT1"){
msg['FT1'][i]['FT1.2']['FT1.2.1']= sNieuwVolgnummer;
}
}

the problem is the variable i
when I change this line in following
msg['FT1'][0]['FT1.2']['FT1.2.1']= sNieuwVolgnummer;
then it works fine but just for the first segment

can anyone help?

Erik
Reply With Quote
  #2  
Old 12-23-2011, 10:31 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 4,192
narupley is on a distinguished road
Default

Hmm, how about something like this?

Code:
for each (ft1 in msg.FT1)
	ft1['FT1.2']['FT1.2.1']= sNieuwVolgnummer;
Reply With Quote
  #3  
Old 12-27-2011, 02:53 AM
Erik Erik is offline
Mirth Newb
 
Join Date: Sep 2011
Location: the Netherlands
Posts: 9
Erik is on a distinguished road
Default

thanx Narupley
this works great.
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 -7. The time now is 12:16 PM.


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