web stats
Mirth Community - View Single Post - Conditionally Edit CSV Help
View Single Post
  #4  
Old 06-18-2015, 06:17 AM
mshort mshort is offline
Mirth Newb
 
Join Date: Apr 2015
Posts: 7
mshort is on a distinguished road
Default

Quote:
Originally Posted by flyerman View Post
I see

You have mistakenly put your testing message in the outbound template

Remove it!
You are hard coding your outbound message

______________
<inboundTemplate encoding="base64">bGFzdF9uYW1lLGZpcnN0X25hbWUsZG9i DQptb3VzZSxtaWNrZXksNC8yNS8xOTQ2DQpkdWNrLGRv bmFsZCw3LzcvMTk3Nw0KZG9vLHNjb29ieSwxLzEvMTkwMQ0K</inboundTemplate>

<outboundTemplate encoding="base64">bGFzdF9uYW1lLGZpcnN0X25hbWUsZG9iDQptb3VzZSxtaWNrZX ksNC8yNS8xOTQ2DQpkdWNrLGRv bmFsZCw3LzcvMTk3Nw0KZG9vLHNjb29ieSwxLzEvMTkwMQ0K</outboundTemplate>
This was the issue! Didn't realize I still had that in there, removed the Outbound Message Template, and it does work fine!

Thank You flyerman!!!

Quote:
Originally Posted by flyerman View Post
I tested your code on Mirth 3.1.1.7461

Your code is working fine

mouse --> test


_______________
Can U put a few logger.info to confirm everything is correct

logger.info("msg['row'][1]['column1'].toString() before loop = " + msg['row'][1]['column1'].toString())
for(var i = 0; i< msg['row'].length(); i++) {
logger.info("i = " +i)
if (msg['row'][i]['column1'].toString() == "mouse") {

msg['row'][i]['column1']= "test";
}
}

logger.
info("msg['row'][1]['column1'].toString() after loop= " + msg['row'][1]['column1'].toString())

The log should comes out as
INFO (transformer:?): msg['row'][1]['column1'].toString() before loop = mouse
INFO (transformer:?): i = 0
INFO (transformer:?): i = 1
INFO (transformer:?): i = 2
INFO (transformer:?): i = 3
INFO (transformer:?): msg['row'][1]['column1'].toString() after loop= test
I added the logger info above and it recorded something slightly different that what you expected (even though as mentioned above, the code does work now that I removed the outbound message template). Here is what my log came out as:
INFO (transformer:?): msg['row'][1]['column1'].toString() before loop = test
INFO (transformer:?): i = 0
INFO (transformer:?): i = 1
INFO (transformer:?): i = 2
INFO (transformer:?): i = 3
INFO (transformer:?): msg['row'][1]['column1'].toString() after loop= test[/QUOTE]
So I'm not exactly sure what's going, but your expected before/after loop made since to me and I expected exactly that to be logged...I don't understand why it's logging "test" before the loop and after. But the code works none the less.
Reply With Quote