Jump to content

Importing one Flat file -CSV into relational DB


place
 Share

This topic is 5694 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I ready to cry! I convinced the owners of my company to do online registration and now it's a mess!

Web designer sends me this file (forms.csv) and I need to get it in FMP file, I can't send it. And I don't know how to change it to the needed formate... I'm so ready to cry!

Is there a way to set the fields import, and how can I divide up the flat database to import into two files?

Gratefully,

Kim

forms.txt

Link to comment
Share on other sites

It looks like you have a tab-delimited file. Is it only 1 file? What do you mean by "Page1", "Page2", etc.? Is that what's actually in the file? Is there actually a blank line between the sections? These things matter a great deal to someone parsing the file; we have to see exactly what you get (the exact format anyway, sample data is fine).

Are you processing this on a Mac? Because if so you could go through the file with AppleScript, and write each "section" to its own file. Then it's just 3 separate tab-delimted imports (or write the records directly with AppleScript, either way, not sure which is fastest, probably depends on the size of the files).

Otherwise you could import the whole file into a FileMaker field (likely global), then loop through the lines, setting each value into its proper table and field. You have the Child_id. You do not have a Parent_id. This is not a big problem in this case.

Are these always (always) new registrations? Or could one possibly conflict with an earlier record?

In any case it would be good to capture the name of the file, so you don't accidentally import one twice. Also fairly easy with AppleScript. Or you can use FileMaker Import's "Matching records" option, or, if looping, test for existing.

Link to comment
Share on other sites

Hi Kim, don't cry yet. Try the following manual steps:

1) File>Open

2) in the Files Of Type dropdown select Tab Seperated Text Files (*.tab, *.txt)

3) Select your forms.txt file

4) in the First Row Option dialog box select the Data radio button & Click OK.

5) Name your new FileMaker file and click save

If you need further help in getting your file into a usable format see if the attached helps at all.

z_forms_Converted.zip

Link to comment
Share on other sites

Also, you said "csv", but your file is tab-separated. If it is only one file then one simple import is not going to work, as the columns (fields) are not the same.

I'm not sure if that is directed at me or the original poster??? I too noticed the file was Tab seperated not COmma Separted and that is what I used in my example file.

The script I attached would find the Page2 records and export them to there own tab seperated file as attached. Since the file contains the column headings the new text file should be able to be mapped to the final Page2 data file(with first row contains field names).

Yes, it would require a few export files and more importing but it could all be scripted.

Page2.txt

Link to comment
Share on other sites

This topic is 5694 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.