web stats
Repeating field blank or not blank conditions - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-22-2020, 05:14 AM
Ozz Ozz is offline
OBX.2 Kenobi
 
Join Date: Apr 2015
Posts: 54
Ozz is on a distinguished road
Default Repeating field blank or not blank conditions

Hi all,

Trying to fix someone's old code and running into an issue on how to fix what they had going on.

Here's an example of the segments:

We need to trigger code when CON.3.1 = "Success" & CON.11.2 = "1".

CON|1||RandomValue|||||||
CON|2||Success||||||||10^1| (this is the segment we want to trigger the code)


We want to skip CON|1 since it doesn't match the criteria. we want the code to trigger for CON|2 since it does match.

What I'm seeing is that the transformer gets caught on CON|1 and says it cannot read property CON.11.2 from undefined. Best I can tell, this references the CON|1 and that's because there is no CON.11.2 value present.



I've tried a few various things but nothing changed the error message. I know I have to change how it loops or references the CON.11.2, but I can't yet figure out how to tie it all together.



Code:
      for (var y = 0; y < msg['CON'].length(); y++)

                                if ( msg['CON']['CON.3'][y]['CON.3.1'].toString() == 'Success'  &&  msg['CON']['CON.11'][y]['CON.11.2'].toString() == '1')


{

                                                if (msg['CON']['CON.11'][y]['CON.11.1'].toString() ==  "10")

                                                {

                                                                Consent = "T";

                                                }             

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


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