Jump to content

Importing Field Names and Data

Recommended Posts

I am trying to import data from a MySQL database and need to somehow also import fieldnames to be the fieldname in FMP. Is there anyway to do that? I have a CSV of the fieldnames and I also have a MySQL dump of fieldnames and associated data.

Thanks for any help.

Edited by mountainx
Link to post
Share on other sites

If you have a .csv file that contains field names in the first row and data in the other rows, you can import it into a new table and designate the first row to be used as the source for field names in the new table.


Link to post
Share on other sites

What about an existing table? If I deleted the old fields that corresponded to "last year's data", can I append the fields to an already existing table?

Link to post
Share on other sites

Well actually, we use this database once a year for a yearly survey so the fieldnames in the survey each year are unique - survey_numberXgroup_numberXquestion_number. So last year's data has absolutely no relevance and get deleted. It may be wrong, but it is the way it was designed. IS that still a no?

Link to post
Share on other sites
3 minutes ago, mountainx said:

the fieldnames in the survey each year are unique

It makes no difference. Adding data to a table should not require a change in schema. You should have a permanent set of fields that includes a field to store the year, if necessary.

In any case, it is not possible to change a table's schema programmatically. At least not from within Filemaker (it may be possible using a third-party application that connects to Filemaker via ODBC or JDBC).


Link to post
Share on other sites
  • 2 months later...


hope it’s not to late to answer.

It really seems to make no sense to have new field names each year for the same kind of data.

If you can somehow create fields that you can reuse each year, then the following would be my suggestion:

Since you seem to know SQL, I would suggest FileMaker’s Execute SQL function. With a free plugin (SQL Runner from Dracoventions; super great product, btw.) you can do INSERT INTO as you wish.

The steps would be: 1) Paste SQL DUMP into a text field. 2) In a script, read line after line of the text field and put the data of each line into $Variables. 3) Using the Execute SQL script step you can easily INSERT INTO the lines into your FileMaker data base.

Hope this helps,


Link to post
Share on other sites

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
  • Similar Content

    • By Sinky
      Hi people! I hope someone can shed some light on the following issue.
      I made a simple script for button to import the data from .xlsx and update a field. Script works good but I have a problem with the last step. If xlsx contains the data for import, field gets updated and record is not shifted. Fine.
      However, if the .xlsx has no data to import, FM automatically shifts to the first record. What I would like is that in the latter case record is not shifted or in other words... I press the button, there is no import because there is no new data, current record is not shifted.
      I tried with Go to Record as the last step but none of the offered options (first, last, previous, next) does the job. I guess I should use calculation option but I'm completely clueless what to put in.
      Tnx in advance!!!

    • By Buckie
      Tried adding an ODBC source using both MySQL 8.0.22 and MariaDB 3.1.10 drivers in Unicode mode and I can connect just fine, however it's impossible to add a table onto the relationships graph. It sees the table's name but when I try to add it, I get 
      This action cannot be performed because the required table is missing. error. It works fine with ANSI version of the MySQL driver, sans the ability to work with Unicode of course. I've tried multiple combinations, including making the database and the table strictly "latin", it still refuses to add the table. The test database itself is very simple, just a single table and a single field, no spaces and no unicode characters in names. Test/test/test, basically, tested with an empty FM database. The server is running MariaDB 10.4.16. Any pointers to solve that?
    • By gczychi
      all I need is to read the content of a text file into a text field and I can’t figure out how.
      Situation: I have ≈150’000 folders, each with one image file and one xml/text file with meta information about the image file. The image file and the meta data need to go into the same record.
      I’ve looked for hours now, but couldn’t find a solution:
      • I can’t use the import folder command, because it creates new records for each file in a directory.
      • I can’t use Do AppleScript > do shell script > cat x.txt, because I can’t get the result into FileMaker.
      • I can’t use the new Read File script step of FM18, because the solution is on FM16 and FM17. (I tried it nevertheless, but all I got was the filename!?)
      • I’cant use a plugin (MBS would work just fine, I think).
      So, what are my options? Any ideas?
      I would love to insert the xml file into a container and then read the container raw data — but how? A couple of years ago, I have read about someone actually doing this, but I can’t remember where or how. That would be cool!
      Any other suggestions?
      Thanks so much!
    • By stan111
      there is a price list in Excel with images embedded. Do you have an idea how to import those records into DB with corresponding images preserved?
      Note that I've attached only two records, there are 600 of them. Any manual manipulations with the images is not an option.
    • By winklestork
      I have searched the forum and internet and not found an answer to my delima.
      I have a solution with a scripted import of a csv file. I do not want import dialog (e.g. mapping), so I have it set to no.  I don't know the name of the file, only that it is a csv file. If I leave the filename out of the import dialogue, the default SHOW filetype in the open file dialog is for a filemaker database. The user needs education to change the SHOW to csv or all. That is undesirable. If I import a correct file once, the next time the script runs in that session, it prompts for a csv file, but if I quit the application and run it again, it goes back to SHOWing  filemaker databases. If I provide a bogus file, e.g. YourFile.csv -- I have to capture errors or I get no file dialog for them to find their file. If they cancel, they get a filemaker dialog I don't control that tells them the user aborted the import, continue or cancel. If they cancel, the script exits and I don't get control. That, too, is undesirable.
      What is the best practice for scripted imports so that whether the user complies or cancels, I maintain control of what happens next?
  • Create New...

Important Information

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