Announcement

Collapse

Mirth Connect 4.1.1 Released!

Mirth Connect 4.1.1 is now available as an appliance update and on our GitHub page. This release contains modifications to the Welcome to Mirth Connect screen and two fixed defects. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Create a new CSV using the contents of an existing CSV

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create a new CSV using the contents of an existing CSV

    Hi,

    I am trying to create a CSV using the contents of another CSV in mirth. Need help.

    Inbound CSV

    PatientID,MRN,OrderID,SampleID,CollectionDate
    123,acb123,12345,xyz986,3/24/2022
    456,bcd234,23456,pqr654,4/24/2022
    789,def345,34567,mno321,5/24/2022
    .
    .
    .

    Outbound CSV

    MRN,OID,PID,COLLDATE,SID
    acb123,12345,123,3/24/2022,xyz986
    bcd234,23456,456,4/24/2022,pqr654
    def345,34567,789,5/24/2022,mno321
    .
    .
    .

    Thanks

  • #2
    Please read the forum etiquette at https://forums.mirthproject.io/artic...orum-etiquette

    Note bullets 5,8,9,10.
    Diridium Technologies, Inc.
    https://diridium.com

    Comment


    • #3
      Hi,

      My apologies sir for not providing the details around the steps I have been trying. Finally, I am able to get this working.

      var csv = <delimited>
      <row>
      <column1>MRN</column1>
      <column2>OID</column2>
      <column3>PID</column3>
      <column4>COLLDATE</column4>
      <column5>SID</column5>
      </row>
      </delimited>;

      for (var i = 1; i <= msg.row.length()-1; i++) {
      var row = <row/>;
      row.column1 = msg['row'][i]['column2'].toString();
      row.column2 = msg['row'][i]['column3'].toString();
      row.column3 = msg['row'][i]['column1'].toString();
      row.column4 = msg['row'][i]['column5'].toString();
      row.column5 = msg['row'][i]['column4'].toString();
      csv.appendChild(row);
      };

      msg = csv;

      Please let me know if there's anything that I can do in order to fine-tune this.

      Thanks.

      Comment


      • #4
        If it works and your CSVs are not too large, I'd go with it!
        Diridium Technologies, Inc.
        https://diridium.com

        Comment

        Working...
        X