web stats
Testing Message Elements for Empty? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-27-2012, 01:31 PM
rvarno rvarno is offline
Mirth Newb
 
Join Date: Feb 2012
Location: Syracuse NY
Posts: 8
rvarno is on a distinguished road
Default Testing Message Elements for Empty?

OK, I am attempting to De-Identify Messages for testing purposes. So any sensitive msg elements (ei: PID.3.1) need to be changed to fictional data.
So what is the easiest way to accomplish this ? It doesn't look like the Message Builder "String Replacement" will work . . . so what J-Script code will do this.

If PID.3.1 is NOT equal to BLANKS then fill with "XXXXXXXX"
where "XXXXXXXX" is anything I want it to be.
Reply With Quote
  #2  
Old 04-28-2012, 06:32 AM
mourisj mourisj is offline
Mirth Guru
 
Join Date: Feb 2007
Location: Luxembourg
Posts: 399
mourisj is an unknown quantity at this point
Default

I would create a variable containing a number on the globalMap (for example called anon)
Then, for every message going through my channel, i'd set PID.3.1 with "ANON" + anon, and increment anon before going to the next message.
To make it nicer, you could even left-pad the variable up to the number of positions you need.
This would give you contents like ANON00001, ANON00002 etc. in you PID.3.1
__________________
JJ Mouris
FFE Luxembourg
IT-Department
Reply With Quote
  #3  
Old 04-30-2012, 07:10 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 4,675
narupley is on a distinguished road
Default

Basically, it would go something like this:

Code:
if (msg.PID['PID.3']['PID.3.1'].toString())
	msg.PID['PID.3']['PID.3.1'] = 'XXXXXXXX';
Or, another way to do it is to create an outbound template with all of your dummy info, and then only map into tmp the fields that you wish to overwrite.
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 01:56 PM.


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