Reading file and formatting as a string

0
Hi I'm having a text file having some data given MSH|^~\&|AAA|abc|ABC|abc|20171007064156||ORM^ORM^ORM_001|100||2.5.1|||NE||||ABC|A01|20161007064148|||||||||| PID|||111111||one^two^^^^||11111|Female|||111 Fith Street^^abc^AC^95111|AB|222222|||||5555550|555-00-5555|||||||||AB|| I needs to split the text file using MSH,PID as separators and create two strings should have MSH as a string ,PID as a another string.Is there any way to do that?  
asked
1 answers
2

Hi Menagapriya,

 

Provided that $InputString is your string with both MSH and PID lines you could do the following in a microflow:

Create a Variable String with this expression “substring($InputString, find($InputString, 'MSH'), find($InputString,'PID'))” to get your MSH String.

 

Create a Variable String with the expression “substring($InputString, find($InputString,'PID'))” to create your PID String.

 

This would give you the two separate strings but only works if the format of your input string is always the same.

 

My first option would be to add a HL7 Java Library to the Mendix project and create Java Action to and the parsing tools of the library to work the message.

 

The microflow is shared here: https://modelshare.mendix.com/models/6b7b3271-86ae-46a0-ae76-ef8f7cb18c9b/conversion-msh-pid

 

Cheers,

 

John

answered