3 Replies Latest reply on May 19, 2011 10:40 AM by RedL

    create new table and field on external fp7 database by script

    RedL

      Title

      create new table and field on external fp7 database by script

      Post

      I separated layout and data by two fp7 files, called it as UI.fp7 and Data.fp7.  When I update UI.fp7, it needs new tables and fields on the data.fp7.  Due to the data.fp7 is offsite and I have different data.fp7 files.  I need to create new tables and new fields on each data.fp7.  How can I create table and field by script?

        • 1. Re: create new table and field on external fp7 database by script
          aammondd

          There is a convoluted way to have a script create a new table in the same or other database by script using the current versions of Filemaker. (*.fp7 is simply the file format) It is also very very limited in its application and is based solely on therory Ive never actually tried it.

          It would require you to store fieldnames and formats as data in a table as records. (this might be possible within the script itself )

          Then you would have to loop through those records creating a single text string of field names as if it were a header record in a csv file.

          At he same time you would want to create another text string of default data values in order to differentiate date, number and text fields.

          You would want to write these text strings into 2 records in another table then export them as a csv file with the filename equal to the tablename you want to create

          Then you would have to trigger an import script to import it as a new table using the first header line as field names. (you could trigger an external script if porting to another database)

          The new table would have no calcuation fields or optional settings and would need to have relationships added.(im not even sure if it will format number and date fields) But at least you would have ported the table and fields. You could store any calculations as text in a third string (you would need a table of table and field names storing the text of the calc) and import those so you could copy them to the clip board then change the field type.

          The work necessary to do this would probably exceed the work to just build the table from scratch.

           

          • 2. Re: create new table and field on external fp7 database by script
            philmodjunk

            It might be easier to distribute a new copy of the data file to each site with the new table added, then run a script that imports all records from the existing data file, and also update the next serial value settings of any auto-entered serial number fields. With the import script run, you can then swap out the old copy for the new.

            • 3. Re: create new table and field on external fp7 database by script
              RedL

              Thanks.  Looks like new data file with script to import from existing data file is the choice.