web stats
Testing Message Elements for Empty? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 04-27-2012, 11:31 AM
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
Old 04-28-2012, 04:32 AM
mourisj mourisj is offline
Mirth Guru
Join Date: Feb 2007
Location: Luxembourg
Posts: 405
mourisj is an unknown quantity at this point

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
Reply With Quote
Old 04-30-2012, 05:10 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
Join Date: Oct 2010
Posts: 6,972
narupley is on a distinguished road

Basically, it would go something like this:

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

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 09:32 PM.

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