You have to login in order to post a reply to this topic.

9 replies [Last post]
Mister Ed
User offline. Last seen 1 year 35 weeks ago. Offline
Joined: 06/02/2010
Posts: 6

Hi,

I'm thinking Winautomation would be the right tool for this job: I've got an automated regular download of data from a server in the form of a pipe-delimited text file (I have a few options available in how this file is configured, but it has to be a text file). I need to place this data into a MySQL database at regular intervals (probably daily).

Can Winautomation do this for me?

I'm going to set up my MySQL database right now, and read the Winautomation documentation. Just thought maybe someone had been through a similar routine before and could give me a few pointers. I'm more of a web design guy than a hard-core programmer, but am working on my development capabilities.

Thanks.

D.M.Altizer
User offline. Last seen 1 year 11 weeks ago. Offline
Joined: 01/12/2010
Posts: 204
Re: using winautomation to insert data in text file to MySQL

Yep. Absolutely. The actions that you will probably need are the following:

- "Read Text from File"
- "Split Text"
- "For Each"/"End Loop"
- "Execute SQL Statement"

You will also have to check the following URL:

http://connectionstrings.com/

in order to find the connection string that will allow you to connect to your database. 

If you can attach some sample files or screenshots, I will be able to provide you with more information about how you can do it.

__________________

==Dedicated Automation Solutions==

__________________

==Dedicated Automation Solutions==

Mister Ed
User offline. Last seen 1 year 35 weeks ago. Offline
Joined: 06/02/2010
Posts: 6
Re: using winautomation to insert data in text file to MySQL

Hey, thanks a lot for the quick response.

I've attached a text file of data that I downloaded from the server (I removed all but the headings and first 5 records).

I'll check that link you provided and finish setting up the MySQL table. Will check back in later this afternoon. Thanks again!

AttachmentSize
test-datafile.txt 2.3 KB
D.M.Altizer
User offline. Last seen 1 year 11 weeks ago. Offline
Joined: 01/12/2010
Posts: 204
Re: using winautomation to insert data in text file to MySQL

 The format of the file helps a lot actually. All you have to do is read from the text file as a list. Then for each item in the list, you will just have to replace the | with ', '

After doing that, append a single quote at the beginning and the end of the string and use the "Execute SQL Statement" directly to execute an INSERT command to your database. If this seems weird to you, let me know and I can create a sample job for you. Sometimes these descriptions sound a lot harder than they actually are.

__________________

==Dedicated Automation Solutions==

__________________

==Dedicated Automation Solutions==

Mister Ed
User offline. Last seen 1 year 35 weeks ago. Offline
Joined: 06/02/2010
Posts: 6
Re: using winautomation to insert data in text file to MySQL

Wow, that sounds like a no-brainer. The application I'm using to download the data (RETSConnector) lets me choose "tab", "CSV", or "pipe" for the delimiter. I was advised to use "pipe" (maybe because some of the data may contain commas?), but it sounds like maybe I should use CSV?

I have used MySQL commands like INSERT before so that doesn't sound weird to me at all.

I may need a little hand holding in configuring Winautomation, but let me give it a whirl.

Thanks for you help. I'm just now getting a minute to set up my table...

Mister Ed
User offline. Last seen 1 year 35 weeks ago. Offline
Joined: 06/02/2010
Posts: 6
Re: using winautomation to insert data in text file to MySQL

Alright, I've built the MySQL db and have a table all ready to receive the data from the textfile. I've installed Winautomation and am now building a new job. The first action, as you suggested, is "Read Text from File." I want "store file content as" to be set to list, not single text item, right?

Mister Ed
User offline. Last seen 1 year 35 weeks ago. Offline
Joined: 06/02/2010
Posts: 6
Re: using winautomation to insert data in text file to MySQL

When you say "append a single quote at the beginning and the end of the string" which winautomation action would I use to do that? I've looked through them and am not seeing which one I would choose...

Mister Ed
User offline. Last seen 1 year 35 weeks ago. Offline
Joined: 06/02/2010
Posts: 6
Re: using winautomation to insert data in text file to MySQL

Sorry, one more question. I'm writing my SQL statement in the dialogue box for the "Execute SQL Statement" action, and am scratching my head on what to write after "INSERT INTO" and the table name...I'm thinking if the fields in the text file are exactly in the same order as the fields in the MySQL table (and they are), it should be a snap to insert each row. I must reference the variable name that Winautomation uses to hold the text data?

Thanks for the help...

Thomas Minitsios
User offline. Last seen 1 year 4 weeks ago. Offline
Joined: 07/16/2009
Posts: 34
Re: using winautomation to insert data in text file to MySQL

I need more specific (and possibly sensitive) information in order to assist you, so I'm sending you an email.

D.M.Altizer
User offline. Last seen 1 year 11 weeks ago. Offline
Joined: 01/12/2010
Posts: 204
Re: using winautomation to insert data in text file to MySQL

Is there any progress in this issue? Ed, do you need any more help?

__________________

==Dedicated Automation Solutions==

__________________

==Dedicated Automation Solutions==