11/22/2024 9:55:45 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss using SQL SSIS or DTS to perform SalesLogix imports. View the code of conduct for posting guidelines.
|
|
|
|
Importing Text Files Into A SLX Table
Posted: 16 Mar 06 3:46 PM
|
fiogf49gjkf0d Hi all,
SLX 6.2.3
I have a directory that contains 69 individual text files that I'd like to import directly into a SalesLogix table.
I really only want to specify a directory, and have a DTS to go ahead and import all the files for me, without any user intervention. I'm happy to hard code the directory (as it's not likely to change once set up), but I'm at a loss as to how to cycle through the files and import the info into my table.
Any suggestions? What's the best way to proceed?
Also, is there anything special I need to do have the OLEDB Provider Auto-generate the record ID's for me? Will it also auto-create the CreateUser/Date and ModifyUser/Date field data, or do I need to do that myself?
Thanks, Antony Currington Technical Consultant Trialta |
|
|
|
Re: Importing Text Files Into A SLX Table
Posted: 16 Mar 06 5:09 PM
|
First of all, unless you're able to use SSIS (which can traverse files in a directory quite nicely) then you'll need to write some VBScript/JScript in a DTS ActiveXScript task to get all the files in the dir.
Basically you'll create a package with a Text File connection in the package and set it up to go to the right target table(s) and the rest of your package. The difference here is that you need to dynamically set the connection (text connection) source at runtime and have it do it's work then start again with the next source. To do that you'll need to use the FileSystemObject to run through the files in the directory. However as each file is found you will need to set the text connection source, like this (We'll say your text connection is named "Text Source"):
Set oConn = DTSGlobalVariables.Parent.Connections("Text Source") oConn.DataSource = sFilename
Then you set the workflow to continue and then make the flow of the package loop back to itself so you can get the next file and continue like that. Once you've traversed all files in the directory you set the task status to break the loop and continue with the normal workflow of the package. There are many ways to accomplish that, but that is the long and short of it.
I checked one of my favorite DTS sites and there happens to be an example showing just what you need to do:
http://www.sqldts.com/default.aspx?246
Also, SLX will not create values for createdate/user and modifydate/user, you'll need to populate those. Actually you will need to populate everything. You can turn on auto-increment for the id value on the tables you'll be importing to (see the field properties in the administrator), but that can also be set at execution time (you can just update the table that stores whether autoincrement is on for your table - I think it is the autoincrement field on the sectabledefs table).
-Ryan |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|