web stats
Updating SQL DB from a CSV File - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-31-2013, 01:53 AM
arazak arazak is offline
Mirth Newb
 
Join Date: May 2013
Location: Riyadh
Posts: 6
arazak is on a distinguished road
Default Updating SQL DB from a CSV File

I'm quite new mirth

I receive periodic data extract in the form of CSV containing multiple records that I want to update in a SQL table. I succeeded with single records, but don't know how to loop through multiple records in the CSV

Please help.
Reply With Quote
  #2  
Old 09-03-2013, 07:22 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,097
narupley is on a distinguished road
Default

Quote:
Originally Posted by arazak View Post
I'm quite new mirth

I receive periodic data extract in the form of CSV containing multiple records that I want to update in a SQL table. I succeeded with single records, but don't know how to loop through multiple records in the CSV

Please help.
You can do that in many ways. One way is to turn on batch processing (enable it in the Delimited Text settings, and set Process Batch: Yes on your File Reader), so that your channel handles every record as a discrete message and can perform a database update for each one with a Database Writer.

Another way is just to read in the entire CSV as a single message, iterate through the rows/columns in JavaScript, and for each row (or however you want to do it) perform a manual database update. There are entries in the References tab to can help with connecting to databases and performing queries/updates.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 09-26-2013, 02:13 AM
arazak arazak is offline
Mirth Newb
 
Join Date: May 2013
Location: Riyadh
Posts: 6
arazak is on a distinguished road
Default Updating SQL DB from a CSV File

Thanks narupley

Apologies for the late response.

resolved using javascript iteration

Last edited by arazak; 09-26-2013 at 02:36 AM.
Reply With Quote
Reply

Tags
csv, multiple lines, sql server

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 09:51 AM.


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