web stats
EDI 834 -> CSV FIle - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-14-2018, 09:13 AM
bdoubleu bdoubleu is offline
Mirth Newb
 
Join Date: Sep 2018
Posts: 6
bdoubleu is on a distinguished road
Post EDI 834 -> CSV FIle

Hi All,

I am trying to Convert an 834 to a CSV
  • I created the channel (834 Channel)
  • Set data type to (inbound EDI X12)(Outbound XML)
  • Set source to C:/Mirthfiles
  • In Destinations, I have a channel writer with nothing other than (${message.encodedData})

I am stuck.

I have a subsequent destination as (File Writer) with a directory of C:/mirthfiles/complete/output

And the template is ${message.transformedData}

I am assuming I need the interim step of converting to XML, so I can then go from XML to CSV, correct?

Or can I just pull the XML from the channel (how do I do that) and then ad a step to convert and save as CSV?

Please help and thanks in advance!
Reply With Quote
  #2  
Old 09-14-2018, 09:45 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 435
agermano is on a distinguished road
Default

You want to use Delimited as your outbound type instead of XML. Delimited is still represented by XML in the transformer, but in a specific way that the transformer will know how to convert it when it's finished. The default parameters of Delimited are typical CSV settings.

Converting EDI to CSV will require a good deal of work since the formats are so different, and EDI is somewhat difficult to manipulate in mirth in the first place. Mirth will give you direct access to segments and fields, but it won't organize them into Loops for you.
Reply With Quote
  #3  
Old 09-14-2018, 10:27 AM
bdoubleu bdoubleu is offline
Mirth Newb
 
Join Date: Sep 2018
Posts: 6
bdoubleu is on a distinguished road
Default

Thanks Agermano

I am making a little progress. I got the XML to write out to a file. I also can pull in the XML as a template and see that I can create variables.

My hopes were that I could convert to XML (assuming that the converter iterates through the loops properly, without manual intervention) and then map a few fields that I want like:

FirstName
LastName
PolicyNumber
ID

Just so a human can look at a file and get a count of members easily.

Am I heading down the right path here or should I be looking at doing something else?

Thanks Again!
Reply With Quote
  #4  
Old 09-14-2018, 10:46 AM
bdoubleu bdoubleu is offline
Mirth Newb
 
Join Date: Sep 2018
Posts: 6
bdoubleu is on a distinguished road
Default

I just tried changing from Convert from EDI -> XML to EDI -> Delimited text


Now instead of XML output I get the following as the full contents of the file:

<?xml version="1.0"?>
<delimited/>
Reply With Quote
  #5  
Old 09-14-2018, 10:58 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 435
agermano is on a distinguished road
Default

The XML you see is how mirth deserializes the EDI file so that it can be interacted with in the transformer. It's basically just breaking up the message into segments and fields by the EDI delimiters. The parser doesn't have knowledge of loops. If you ask for NM1 segments in the message, it will give you all of them without context.

If you want to have an intermediate XML representation that is entirely up to you. If you don't need the intermediate representation, it is probably just as easy to map directly from EDI->CSV as EDI->custom XML->CSV.
Reply With Quote
  #6  
Old 09-14-2018, 11:07 AM
bdoubleu bdoubleu is offline
Mirth Newb
 
Join Date: Sep 2018
Posts: 6
bdoubleu is on a distinguished road
Default

Quote:
Originally Posted by agermano View Post
map directly from EDI->CSV as EDI->custom XML->CSV.
So in the scripts tab, just choose: "Convert EDI / X12 to XML (custom)



Like in the image?



And set the data types like this?


Last edited by bdoubleu; 09-14-2018 at 11:09 AM.
Reply With Quote
  #7  
Old 09-14-2018, 12:26 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 435
agermano is on a distinguished road
Default

The data types part is correct. You'll want to be doing you work in a transformer (the source transformer by the way you have the data types set up,) not the deploy script. Using the inbound and outbound templates will give you a drag-and-drop interface where you can map elements from your edi message to your csv file. Due to the complexities of the edi format, you will probably have to also use some Iterator or Javascript steps.

The mirth user guide should be helpful in explaining some of the things I mentioned above. You can get it from the mirth downloads page. I'd also recommend joining the Mirth slack channel for help with specific questions if you get stuck. You can usually get a faster turnaround there as it's more interactive than the forums. See link for Slack info.

https://www.mirthcorp.com/community/...d.php?t=216581
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 -8. The time now is 12:13 AM.


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