web stats
Is this error actually expected behavior? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-20-2016, 06:21 AM
collinsmj collinsmj is offline
OBX.1 Kenobi
 
Join Date: Jun 2014
Location: Southern USA
Posts: 27
collinsmj is on a distinguished road
Default Is this error actually expected behavior?

Hello Mirth Community,

I assume I have committed a faux pas in my transformer and the end result was expected just not desirable.

Server: Windows Server 2012 R2 Standard
Version of Java: Java 8 111 x64
Version of Mirth: 3.4.2.8129
Database: Postgres 3.6
I have cleared the Java Cache

Issue appears under the Destination Transformer:

I need to move data from 1 field in a custom segment into FT1.20. Prior to this code running their isn't any values in fields past FT1.10. By assigning values to FT1.20 I am creating those fields. If the source string contains a comma it also is moved into FT1.20.2. Here is my code that caused the unexpected behavior.


Code:
var testStr = msg['ZLQ']['ZLQ.8']['ZLQ.8.1'].toString();

// if a comma exists the field is 'lastname, firstname' and thus
// belongs in ft1.20.2 which is the full name of the user
if(/,/.test(testStr)){
	msg['FT1']['FT1.20']['FT1.20.2'] = testStr;
}

// ft1 20.1 is username and is limited in length in the result system. 
msg['FT1']['FT1.20']['FT1.20.1'] = testStr.slice(0, 20);

that runs but here is the resulting xml and actual hl7 of the FT1 sent. The value of ZLQ.8 is Hope, Bob for this example.
Quote:
<FT1>
<FT1.20>
<FT1.20.2>Hope, Bob</FT1.20.2>
<FT1.20.1>Hope, Bob</FT1.20.1>
</FT1.20>
</FT1>

FT1||||||||||||||||||||^Hope, Bob^Hope, Bob
The result is FT1.20.2 and somehow FT1.20.3 are populated. 20.1 is blank even though there is code to populate it. And where did 20.3 come from? To correct this error I just run my if statement after my slice statement it comes out as I expected.

So, is this a bug or expected behavior because I created the fields in reverse order? Is there a proper way to code this behavior?


Thank you for your time,
confused interface programmer
Reply With Quote
  #2  
Old 12-20-2016, 06:44 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 556
kirbykn2 is on a distinguished road
Default

I have had unexpected results when acting on the XML out of sequence.
try this.

var testStr = msg['ZLQ']['ZLQ.8']['ZLQ.8.1'].toString();

// ft1 20.1 is username and is limited in length in the result system.
msg['FT1']['FT1.20']['FT1.20.1'] = testStr.slice(0, 20);

// if a comma exists the field is 'lastname, firstname' and thus
// belongs in ft1.20.2 which is the full name of the user
if(/,/.test(testStr)){
msg['FT1']['FT1.20']['FT1.20.2'] = testStr;
}
__________________
Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.2
Mirth Connect Version 3.6.1
Java Version 1.6.0_45-b06
Java (64 bit) Version 1.6.0_45-b06
Java 7 (64 bit) Version 1.7.0_151-b15
Java 8 (64 bit) Version 1.8.0_121-b13
PostgreSQL Version 9.6.3
Reply With Quote
  #3  
Old 12-20-2016, 09:01 AM
collinsmj collinsmj is offline
OBX.1 Kenobi
 
Join Date: Jun 2014
Location: Southern USA
Posts: 27
collinsmj is on a distinguished road
Default

Thank you kirbykn2,
That is actually the solution I went with. I am also glad to see others in the community have had weird behavior when working with the fields out of sequence.

But is this an error in Mirth that would deserve a bug report?
Reply With Quote
  #4  
Old 12-20-2016, 09:04 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 556
kirbykn2 is on a distinguished road
Default

I would think yes.
__________________
Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.2
Mirth Connect Version 3.6.1
Java Version 1.6.0_45-b06
Java (64 bit) Version 1.6.0_45-b06
Java 7 (64 bit) Version 1.7.0_151-b15
Java 8 (64 bit) Version 1.8.0_121-b13
PostgreSQL Version 9.6.3
Reply With Quote
Reply

Tags
bug, error, ft1, transformer

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


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