Reading file and formatting as a string

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?  
1 answers

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: