Jump to content

How Do you ADD A NEW RECORD in a related table??

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

Recommended Posts


I am working on a DB Solution that is PROJECT BASED, You create PROJECTS ( JOB ORDERS) in the MAIN JOB FILE and then you add various other info through different tabbed layouts which appear under the JOB INFO at the top half of the layout, for example You add a job, and then related to that job you can add many Quotes, Purchase Orders, Invoices etc.

Each JOB ( Project ) can have more than one INVOICE, QUOTE or PURCHASE ORDER, I have Set Up the Relationships so far using the "SEPARATION METHOD" and the Table structure as such..




On one particular layout ( Which is set to JOB ORDER) as the current table, I have a "PORTAL" of Items that belong to the "QUOTE ITEMS" Table for example. I wish to display the QUOTE ITEMS from Different QUOTE ORDERS that are created for a particular JOB ORDER.

I have a "POP-UP" list ( Above the portal) which can display the QUOTE NUMBERS for a particular JOB ORDER ( Project) so that I can filter the QUOTE ITEM RECORDS in the Portal.

I have a Button that says "CREATE NEW QUOTE" on this layout

My question is..

How do I make script (linked to the button "CREATE NEW QUOTE"), that can add a "NEW QUOTE NUMBER" in the related QUOTE MAIN table from this layout?

FM7 will ONLY allow you to add "NEW RECORDS" to the main file! ( in my case the JOB ORDER Table). How Can I tell FM7 to ADD a New QUOTE ORDER to the QUOTE ORDER TABLE" using a script?

I have attached a sample of my layout for viewing.


Dave M


Link to post
Share on other sites
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Freeze Window

Go to Layout [ any layout for the Quote Order Table ]

New Record/Request

Go to Layout [ original layout ]

Link to post
Share on other sites

Thanks Vaughan,

I forgot about the "FREEZE Window" Function,

I also Added a step to paste the current job number in the Quote Main Table so I can reference them later.

Thanks for the quick, useful and easy answer!

Dave M

Link to post
Share on other sites

If you're in a multi-user situation, it's better to use a calc of serial_1 (serial & "_1") rather than just 1,

so that one user doesn't affect another's accidentally, if both are running the script at the same time.

Link to post
Share on other sites

One technique I often use is the concept of a creation relationship

create in destination table a number field called "Create" --

In start tabe, create a calc field "k_ONE" with calc value 1

create a relationship between two tables based on k_ONE = Create. set the destination of relationship to beable to create a record.

Write your script such that:

Set Field [Create_in_DestTable::Anyfield; DataToSet]

# in setting the data it will create the record.

# Note Create_in_DestTable is a TO or the destation table at the end of the relationship above.

Set Field [Create_in_DestTable::WhateverElse; MoreData]

# Other set fields...

# Set a currentRelatedRecord if desired

Set Field [ThisTable::gCurrentRelatedRecord; Create_in_DestTable::recordID]

Set Field [Create_in_DestTable::Create; 0] // Releases the creation relationship.

There as several nice benefits of this technique:

1) you can very easily create records in tables in other databases without having to run external scripts or jump around relationships.

2) You can also very easily populate data without having to have globals to hold information used to populate the new record (ie making a partial duplicate of an existing record)

3) You can also build your relationship to be predicated on more than just one key (the k_ONE =Create).

By doing so, you can file in many pieces of data at the point of creation.

The downside to this is the possibility that a stale "unclosed" creation exists... (ie a record has the 1 in the create field before the creation will result in overwriting existing data rather than creating a new record. but this can be taken care of by an if scriptstep and loop beforehand:

if [isvalid(Create_in_DestTable::recID)]


Set Field [DestTable::Create; 0] // Releases the pre existing creation relationship.

exit loop if [not isvalid(Create_in_DestTable::recID)]

end if

Link to post
Share on other sites

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By Tony Morosco
      I'm a botanist, and the tables I am working with are for tracking botanical garden collections. The data represents plants in the garden, and the plants are tagged and show up in the database.  The tables I am working with were created in FMP 7, and I'd like to open them up in FMP 11 (or later.)  The system hasn't been used in years, but still has valuable information.
      One of the tables is giving me problems using the FMP convert and recover commands.
      These tables are all inter-related.  The main table is the Accessions table, which contains records for all of one kind of plant, from the same source, received on the same date.  It is basically a museum standard.
      The other tables are related to each other through this one main table.  The Species table is related to the locations table through the Accessions table. 
      (i.e.  table A relates to table C through the table B, the intermediary)  
      From the Locations table, we can't see the the species information unless the accessions table is present.
      When issuing the open command on the main table to convert the database to FMP 11, I get the message:
      "Accessions.fmp7" is damaged and cannot be opened.  Use the Recover command to recover this file. When using the Recover command from v. 11, I get another message:
      WARNING: problems were detected while recovering the database.  Please review the Recover.log file to see where problems were found and their severity.  The recovered file should NOT be used going forward; copy only the most recent work from it into a backup copy of the original file. Recovery results:   File blocks: scanned and rebuilt 563 blocks, dropped 214 invalid data blocks.   Schema: scanned fields and tables, 1 items modified   Structure: scanned; 1 items modified   Field indexes: rebuilt  
      Opening the recovered database, there are only three records present.  There should be hundreds.  So obviously I am looking on how to wrangle this database open.
      I've attached the log file here, as well as the database structure map.  
      The other files have converted just fine.  But since the main table won't open, we are kind of stuck.
      I can share the files with you through Dropbox or whatever, if needed.
      Please let me know any thoughts you have, either basic or advanced.  And ask for any clarifications or additional questions.   :-)  

    • By Tumma K
      Hello, All!

      I am an aspiring developer for Filemaker. The company I work with is stuck in the past working off of Filemaker Pro 4.1

      I was given the task of bringing us up to Filemaker Pro/Server 13. So far my conversion prototypes are successful but we recently had a layout issue that can only be fixed in versions 3-6 (as the file is an .fp3) I work off of a macbook while our network is all Windows 7. In order for me to repair the layouts without tampering our active database, I decided the best option is to repair a copy of our solutions off the network. Unfortunately, when I go to download the trial version of Filemaker Pro 6 off of the respected website, the file is corrupt! I've tried multiple times, with different extraction apps and in different directories.

      My question is;

      Does anyone know a place where I could obtain version 6 (or better yet, 4.0) for an OSX computer? I've looked everywhere!
      Thank you for your time,
      Tumma K.
    • By MrEddByrnes
      I'm hoping my question can have a happy ending. In the mid-90's, I purchased Filemaker 3. When Filemaker 5.5 Pro was released, I bought the update CD, which requires the user to either have FM 3 installed or to have the installation CD for FM 3. I've used it all these years, most recently with Windows XP Pro, and it has worked just fine. The databases I began with were long ago converted to FM Pro 5.5 databases.
      I'm still using FM Pro 5.5 on a laptop with WinXP Pro, but in 2013, I purchased a PC with Windows 8. I haven't been able to install FM 3 on it, therefore can't install FM Pro 5.5. I am retired and rarely use Filemaker, but I have a few Filemaker databases I'd like to add to my Win 8 machine. I don't feel it's worth upgrading FM for the sake of using a couple of databases.
      Has anyone else run into this situation and/or have a (possible) solution? Is there perhaps any other software that can read FM 5.5 databases? Thanks in advance for your help.
    • By bmill
      I am using a custom filemaker solution for medical office billing written with fp5 running on a mac with snow leopard. In addition, I have a patient management db (which I wrote) that is linked through pt. ID number to the billing program allowing transfer of some demographic information (name, DOB, etc).
      Other than being limited by hardware restrictions, the billing program serves our needs for now and upgrading to fp12 will take some time (and money).  In the meantime, I am upgrading my pt. management program to fp13 and would like to move new patient demographic information from the billing program ( fp5 running on snow leopard through Parallels) and the new pt management program ( fp13 running on OS X 10.9) on the same mac.   
      Ideally, demographic information would be entered once into fp5 and then a scipt would make the data available for fp13.
      Any ideas on how to make this work?
    • By randyinla
      Hi, can anyone tell me why my on-line database might have stopped allowing me to delete records?  All of my access privileges and passwords are correct.
  • Who Viewed the Topic

    13 members have viewed this topic:
    JenniSTM  arni  PedroAlex  a_entezari  Daemon  Matt.C  Ocean West  bcooney  Sami SU  doughemi  Steve Martino  mr_vodka  Lola 

  • Create New...

Important Information

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