dbTalk Databases Forums  

relational DB, howHello

comp.databases.filemaker comp.databases.filemaker


Discuss relational DB, howHello in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
nufin
 
Posts: n/a

Default relational DB, howHello - 08-08-2005 , 11:04 AM






Hello,

I defined a relational FMPro db with two tables one for the company
address and the second one for company products. I use a company ID key
to join the two tables.
I designed 2 layouts one for company address and another one for
products. In my company address, I would like to have a button to create
a new product record, the script should switch to the product layout
then edit the company ID field and set the appropriate value for it (th
e company ID from the company address layout).
With this matter, I don't to report manually the "foreign" key in the
product record.
My problem is I do not know how to get the value of the company ID key,

I tested script like that but it did not work :

Go to Layout [ "product" (products) ]
New Record/Request
Go to Field [ product::Company_ID ]
Set Field [ product::Company_ID; GetField ( company::Company_ID ) ]
#

Thanks for reading and for your help
Tof

Reply With Quote
  #2  
Old   
Lynn allen
 
Posts: n/a

Default Re: relational DB, howHello - 08-08-2005 , 12:12 PM






nufin <NUFIN@CZ> wrote:

Quote:
Hello,

I defined a relational FMPro db with two tables one for the company
address and the second one for company products. I use a company ID key
to join the two tables.
I designed 2 layouts one for company address and another one for
products. In my company address, I would like to have a button to create
a new product record, the script should switch to the product layout
then edit the company ID field and set the appropriate value for it (th
e company ID from the company address layout).
With this matter, I don't to report manually the "foreign" key in the
product record.
My problem is I do not know how to get the value of the company ID key,

I tested script like that but it did not work :

Go to Layout [ "product" (products) ]
New Record/Request
Go to Field [ product::Company_ID ]
Set Field [ product::Company_ID; GetField ( company::Company_ID ) ]
#

Thanks for reading and for your help
Tof
You're doing it the hard way.

Put a portal on the company address layout, using the relatonship to the
company products table occurance. Make sure the relationship definition
is set to allow creation of records.

Put fields in the first portal row, also from the company products
relationship, such as Part No, Description, & Price. All the same fields
you want to fill out in the Product detail screen.

Now, when you type in the last portal row, the one with the blank fields
showing, a child record is created WITH the connecting ID data already
in place.

The script above won't work because when you switch layouts, you lose
the context of the former screen, so the script doesn't know WHAT
Company ID to use. To really transfer data that way, use a global field,
either in one of the two tables or in a separate table of globals.

First Set the global field with the current COmpany ID, then switch
layouts, then create the new record and set the Company ID field from
the value in the global.

But I'd try the portal first, to see if that fits your needs. Sometimes
it's better not to switch layouts on users, makes their experience more
seamless.

Lynn Allen
--
Allen & Allen Semiotics www.semiotics.com
FSA Associate Filemaker Design & Consulting


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

Default Re: relational DB, howHello - 08-08-2005 , 02:18 PM



Hi Lynn,

Thanks (once more) for your help.
Ok, if this is hard, this is not for me, at least for the moment.
I will then use the portal method first.
Still many thanks for your time.
Christophe

Lynn allen wrote:
Quote:
nufin <NUFIN@CZ> wrote:


Hello,

I defined a relational FMPro db with two tables one for the company
address and the second one for company products. I use a company ID key
to join the two tables.
I designed 2 layouts one for company address and another one for
products. In my company address, I would like to have a button to create
a new product record, the script should switch to the product layout
then edit the company ID field and set the appropriate value for it (th
e company ID from the company address layout).
With this matter, I don't to report manually the "foreign" key in the
product record.
My problem is I do not know how to get the value of the company ID key,

I tested script like that but it did not work :

Go to Layout [ "product" (products) ]
New Record/Request
Go to Field [ product::Company_ID ]
Set Field [ product::Company_ID; GetField ( company::Company_ID ) ]
#

Thanks for reading and for your help
Tof


You're doing it the hard way.

Put a portal on the company address layout, using the relatonship to the
company products table occurance. Make sure the relationship definition
is set to allow creation of records.

Put fields in the first portal row, also from the company products
relationship, such as Part No, Description, & Price. All the same fields
you want to fill out in the Product detail screen.

Now, when you type in the last portal row, the one with the blank fields
showing, a child record is created WITH the connecting ID data already
in place.

The script above won't work because when you switch layouts, you lose
the context of the former screen, so the script doesn't know WHAT
Company ID to use. To really transfer data that way, use a global field,
either in one of the two tables or in a separate table of globals.

First Set the global field with the current COmpany ID, then switch
layouts, then create the new record and set the Company ID field from
the value in the global.

But I'd try the portal first, to see if that fits your needs. Sometimes
it's better not to switch layouts on users, makes their experience more
seamless.

Lynn Allen
--
Allen & Allen Semiotics www.semiotics.com
FSA Associate Filemaker Design & Consulting

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.