Jump to content

How to make SET-FIELD script post values from CURRENT record rather than first record

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

Recommended Posts

I have a database called CABINET DATA that I use to manage math for my cabinet shop.  


The database contains a lot of fields that are necessary to calculate the math but far more information than we want to have on the shop floor.

I want to be able to extract the  values from just a few of the fields and have them show up on a separate table called CUTLIST.

If, for example, a cabinet contains 4 shelves I want each shelf to show up on the list individually rather than have a separate field that indicates quantity.

By having each shelf show up on a separate line it is easier to see how many shelves have been cut and which ones remain to be cut.


I would like to populate  CUTLIST with values from the current record on CABINET DATA.

To minimize the amount of code needed I would like to do this with a SET FIELD script.


The script I have creates a new record on the CUTLIST table but instead of posting values from the current record always posts the data from the very first record.


Is it possible to script SET FIELD to show values from current record rather than first record?

BOXBUILD Copy.fmp12.zip

Link to comment
Share on other sites

Upon examining your database, the first thing to notice is that you should define your relationship(s) correctly; at the moment it is using two global fields as match fields!


While Cabinet does have a serial field (but it's not being used in the relationship), Cutlist doesn't have any serial fields: neither a primary nor a foreign key field.


Your script is performing a search – what for? Shouldn't there only be a single relevant Cabinet record? Or what does a Cabinet Input record represent? – using Copy (without a field, which copies all fields of the record) and Paste; that can't work (and doesn't). Since there is no error trapping, you probably didn't notice this …


Then, you're going to the other table, creating a new record, but don't do anything to make it a related record (and without a foreign key field, how could you …?) What then is the result calculation of Set Field [] supposed to return?


Also, since Cutlist is supposed to be either a child table, or a one-to-one (or that's what I think; as noted above, I don't really understand your data model), once you've set the foreign key in the new record correctly, there is only one related Cabinet record, so you will always refer to the correct one.


Don't use copy & paste; use Set Variable [] / Set Field [].


Finally, if shelves are an entity in their own right, you should create a Shelves table as a child table to Cabinet; there you can define each shelf individually, gives it its own status etc., remove all fields that are necessary for shelf definition from Cabinet (and create any number of shelves without having to create new sets of fields in Cabinet …)

Link to comment
Share on other sites



Thanks a lot.

I am a pretty good cabinet maker but, as you have pointed out, no so much of a developer.

I was, however, able to take your clues and make it happen.


Thanks  a bunch!!

Link to comment
Share on other sites

This topic is 2880 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

  • Create New...

Important Information

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