dbTalk Databases Forums  

Button to create record in related table

comp.databases.filemaker comp.databases.filemaker


Discuss Button to create record in related table in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kirstychestnutt@googlemail.com
 
Posts: n/a

Default Button to create record in related table - 11-06-2006 , 04:52 AM






FILEMAKER PRO 7

Hello everyone,

I've been running a Stock database for the last year and it currently
has about 1200 records, now I need to add support contract information
for some of the records (but not all of them).

My current thinking is to create a separate SUPPORT table, relating the
serial number field (unique to each item of inventory) to the main
INVENTORY table. I will also have a portal from the SUPPORT table into
a CONTRACTS table, which will hold the details of the various contracts
created to cover the Support.

There could be many Contracts to each Support record, but only one
Support record for each item of Inventory.

I would like to create a button on the Inventory layout which will add
a record to the SUPPORT table, copying the serial number over (and
possibly a couple of other fields). It sounds easy, but I can't think
of any way to do it which doesn't involve cut\paste script steps - I
know there should be an easier way.

I will also like to do the same with a button to add contract
information to the CONTRACTS table from the SUPPORT table (a button to
make the portal to the CONTRACTS table appear perhaps?)

Any help would be muchly appreciated.

Kirsty


Reply With Quote
  #2  
Old   
Ursus
 
Posts: n/a

Default Re: Button to create record in related table - 11-06-2006 , 07:23 AM






Basicaly: you can go two ways.

Create a table with just globals (and remember to add just one record) and
use a script that first set all the globals, then creates a new record in
the table that you need then set all the fields you need with the values
from the globals.

Or use variables

Ursus

<kirstychestnutt (AT) googlemail (DOT) com> schreef in bericht
news:1162810377.110268.149720 (AT) k70g2000cwa (DOT) googlegroups.com...
Quote:
FILEMAKER PRO 7

Hello everyone,

I've been running a Stock database for the last year and it currently
has about 1200 records, now I need to add support contract information
for some of the records (but not all of them).

My current thinking is to create a separate SUPPORT table, relating the
serial number field (unique to each item of inventory) to the main
INVENTORY table. I will also have a portal from the SUPPORT table into
a CONTRACTS table, which will hold the details of the various contracts
created to cover the Support.

There could be many Contracts to each Support record, but only one
Support record for each item of Inventory.

I would like to create a button on the Inventory layout which will add
a record to the SUPPORT table, copying the serial number over (and
possibly a couple of other fields). It sounds easy, but I can't think
of any way to do it which doesn't involve cut\paste script steps - I
know there should be an easier way.

I will also like to do the same with a button to add contract
information to the CONTRACTS table from the SUPPORT table (a button to
make the portal to the CONTRACTS table appear perhaps?)

Any help would be muchly appreciated.

Kirsty




Reply With Quote
  #3  
Old   
Bill
 
Posts: n/a

Default Re: Button to create record in related table - 11-06-2006 , 07:48 AM



In article <454f374a$0$211$dbd41001 (AT) news (DOT) wanadoo.nl>,
"Ursus" <ursus.kirk (AT) wanadoo (DOT) nl> wrote:

Quote:
Basicaly: you can go two ways.

Create a table with just globals (and remember to add just one record) and
use a script that first set all the globals, then creates a new record in
the table that you need then set all the fields you need with the values
from the globals.

Or use variables

Ursus

kirstychestnutt (AT) googlemail (DOT) com> schreef in bericht
news:1162810377.110268.149720 (AT) k70g2000cwa (DOT) googlegroups.com...
FILEMAKER PRO 7

Hello everyone,

I've been running a Stock database for the last year and it currently
has about 1200 records, now I need to add support contract information
for some of the records (but not all of them).

My current thinking is to create a separate SUPPORT table, relating the
serial number field (unique to each item of inventory) to the main
INVENTORY table. I will also have a portal from the SUPPORT table into
a CONTRACTS table, which will hold the details of the various contracts
created to cover the Support.

There could be many Contracts to each Support record, but only one
Support record for each item of Inventory.

I would like to create a button on the Inventory layout which will add
a record to the SUPPORT table, copying the serial number over (and
possibly a couple of other fields). It sounds easy, but I can't think
of any way to do it which doesn't involve cut\paste script steps - I
know there should be an easier way.

I will also like to do the same with a button to add contract
information to the CONTRACTS table from the SUPPORT table (a button to
make the portal to the CONTRACTS table appear perhaps?)

Any help would be muchly appreciated.

Kirsty

IIRC, no variables in FMP 7. Variable came with 8.

Another approach:

Define the fields you want to copy over to the Support table to be
filled by lookups. That will fill them automatically when you create the
new Support record. of course you need a process to create the record
and store the key field for the relationship. You can do that either by
creating the record in the portal, or by use of a script with a global
field to store the key field value and then set the key field value in
the related support table.

--
For email, change <fake> to <earthlink>
Bill Collins


Reply With Quote
  #4  
Old   
kirstychestnutt@googlemail.com
 
Posts: n/a

Default Re: Button to create record in related table - 11-06-2006 , 10:53 AM



Thank you both very much.

I've never used Globals before, so I'm struggling with the application
(though I think I get the concept). I need to copy the existing "serial
number" and "component" fields to the SUPPORT table during the
operation- are you able to give me some simple steps?

Do I need to have an extra key to link the SUPPORT and INVENTORY
databases or can I link the (existing and unique) serial numbers
together (as it will only ever be a one - one relationship).

Next I'm going to start playing with the SUPPORT\CONTRACT portal.
That's going to be fun...


Reply With Quote
  #5  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: Button to create record in related table - 11-06-2006 , 11:03 AM



There were no script variables, but I believe there were script
parameters. Call the related script with the parent record ID as the
parameter and then use get(scriptparameter) in the related file (or in a
second script) to grab the ID. Or if you want to do it all in one
script, you should use global fields as others have suggested to
temporarily store your variables.

Bill wrote:
Quote:
IIRC, no variables in FMP 7. Variable came with 8.

Another approach:

Define the fields you want to copy over to the Support table to be
filled by lookups. That will fill them automatically when you create the
new Support record. of course you need a process to create the record
and store the key field for the relationship. You can do that either by
creating the record in the portal, or by use of a script with a global
field to store the key field value and then set the key field value in
the related support table.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Professional Solutions, Inc. Los Angeles

FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
  #6  
Old   
kirstychestnutt@googlemail.com
 
Posts: n/a

Default Re: Button to create record in related table - 11-07-2006 , 09:26 AM



Thanks for all the help, went for the Globals in the end (and now I
know how to use them! Thanks Ursus


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.