dbTalk Databases Forums  

Re: newbie question: creating a new record in a related file

comp.databases.filemaker comp.databases.filemaker


Discuss Re: newbie question: creating a new record in a related file in the comp.databases.filemaker forum.



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

Default Re: newbie question: creating a new record in a related file - 07-30-2003 , 07:13 AM








somaBoyMX wrote:
Quote:
Hello all,

I've got one file named contacts.fp5, which contains people info and another
named invoices.fp5, containg, well... invoices.

The invoices file has a field "invoice_custid" (unique), which I
successfully related to field "contact_id" (unique) in my contacts file.
When I enter the invoice_custid, it automatically fetches the related data
(name, address, etc) from the contacts file

I want to be able to add a button to my contacts file which instantly
creates a new record in the invoices file related to the current contact
record.

I guess I need some kind of button script to do this, but I'm new to FMP,
coming from MySQL (which has a completely different interface).

All help is much appreciated.

.soma

You can do it with a Portal in the Contacts file. First, the
relationship from the Contacts file as Master to the related Invoice
file has to be defined to allow creation of related records. See File>>
Define relationships in the Contacnts file to do this. Then put a portal
from the Invoices file into a layout of the Contacts file. Put suitable
fields from the Invoices file into the portal, such as date, amount, etc.

Now when you go to the portal, click in the first empty row, and enter
data. That will create a new related Invoice record, related to the
contact. Done. No need for a script.

Bill


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

Default Re: newbie question: creating a new record in a related file - 07-30-2003 , 07:31 AM







Quote:
You can do it with a Portal in the Contacts file. First, the
relationship from the Contacts file as Master to the related Invoice
file has to be defined to allow creation of related records. See File
Define relationships in the Contacnts file to do this. Then put a portal
from the Invoices file into a layout of the Contacts file. Put suitable
fields from the Invoices file into the portal, such as date, amount, etc.

Now when you go to the portal, click in the first empty row, and enter
data. That will create a new related Invoice record, related to the
contact. Done. No need for a script.

Bill
Thanks for the help Bill, very useful. But I think I wasn't specific enough.
I need users to be able to:
* click somewhere in the contacts file (perhaps a button that says: <<make
new invoice for customer>>)
* the invoice file should automatically open, showing a new record tied to
the contacts record
* the user then can fill out this invoice and print it immediately in the
layout specified in the invoice file

I know your way will work, but then the user would need to open the invoice
file, search for the record and print it.

Any hints?





Reply With Quote
  #3  
Old   
Matt Revenaugh
 
Posts: n/a

Default Re: newbie question: creating a new record in a related file - 07-30-2003 , 10:12 AM



On 7/30/03 5:31 AM, in article
3f27bb47$0$273$ba620e4c (AT) reader0 (DOT) news.skynet.be, "somaBoyMX"
<nosuch (AT) fakemail (DOT) net> wrote:

Quote:
You can do it with a Portal in the Contacts file. First, the
relationship from the Contacts file as Master to the related Invoice
file has to be defined to allow creation of related records. See File
Define relationships in the Contacnts file to do this. Then put a portal
from the Invoices file into a layout of the Contacts file. Put suitable
fields from the Invoices file into the portal, such as date, amount, etc.

Now when you go to the portal, click in the first empty row, and enter
data. That will create a new related Invoice record, related to the
contact. Done. No need for a script.

Bill

Thanks for the help Bill, very useful. But I think I wasn't specific enough.
I need users to be able to:
* click somewhere in the contacts file (perhaps a button that says: <<make
new invoice for customer>>)
* the invoice file should automatically open, showing a new record tied to
the contacts record
* the user then can fill out this invoice and print it immediately in the
layout specified in the invoice file

I know your way will work, but then the user would need to open the invoice
file, search for the record and print it.

Any hints?



Use a hidden layout with the invoice portal on it. Make sure that the
invoice::customer_id is in the portal.

Now create a "create invoice" button on the customer screen.

The script should look something like this...

Go to layout "myHiddenLayout"
Go to field (invoice::customer_id)
Go to portal row (last row)
Set field (invoice::customer_id = customer_id)
Go to related record (invoice)

There are some hastles doing it this way though. Like making sure that the
correct layout is there for the user. You may need to add an extra step
like...
Perform script (external invoice::myLayoutSwitch)


Matt Revenaugh






Reply With Quote
  #4  
Old   
Matt Revenaugh
 
Posts: n/a

Default Re: newbie question: creating a new record in a related file - 07-30-2003 , 10:58 AM



On 7/30/03 8:26 AM, in article ypq2he54nihy.fsf (AT) sdf (DOT) lonestar.org, "Lou
Lesko" <lou (AT) NOSPAMlouislesko (DOT) com> wrote:

Quote:
No offense to Matt but there is a much better way to handle your needs.


No offense taken, I just was not sure of the abilities of SomaBoy. A global
field works well too, if you have your ducks lined up. A newbie may be
confused easily.

The problem with your solution is that in the step

SetField[invoice_custid, relationship_to_customer_db::global_cust_id]

there is no relationship_to_customer_db yet!

So, do you need to create a secondary customer relationship to get to the
globals? Or will FileMaker retrieve global_cust_id without a valid
relationship to CUSTOMER?


Matt Revenaugh



Reply With Quote
  #5  
Old   
somaBoyMX
 
Posts: n/a

Default Re: newbie question: creating a new record in a related file - 07-30-2003 , 01:17 PM



Quote:
Good point! I thought he had a relation set up already so that he could
display the customer info on the invoice?
I have. Anyway, thanks for both you guys efforts, with your advise I'm sure
I can handle it from here.
As to my "abilities": this is my first fmPro db, and although I know my fair
share of SQL and relational database theory, it doesn't seem to do much good
on this one. Why did they have to go and call tables "files" and rows
"records"? Why do you have to build "scripts" instead of regular queries and
table joins? Is it supposed to be "user friendly"? Well to me it sure isn't.

I don't think I'll be dabbling with this freak of an rdbms again...

thanks, again,


..soma




Reply With Quote
  #6  
Old   
Glenn Schwandt
 
Posts: n/a

Default Re: newbie question: creating a new record in a related file - 07-30-2003 , 03:48 PM



"somaBoyMX" <nosuch (AT) fakemail (DOT) net> wrote

Quote:
Good point! I thought he had a relation set up already so that he could
display the customer info on the invoice?

I have. Anyway, thanks for both you guys efforts, with your advise I'm
sure
I can handle it from here.
As to my "abilities": this is my first fmPro db, and although I know my
fair
share of SQL and relational database theory, it doesn't seem to do much
good
on this one. Why did they have to go and call tables "files" and rows
"records"? Why do you have to build "scripts" instead of regular queries
and
table joins? Is it supposed to be "user friendly"? Well to me it sure
isn't.

Not unsual. It is "user friendly" for people who know little or nothing
about database design...and for people who are willing (or able) to "forget"
how [insert your favorite rdbms name here] works when they are using
FileMaker.

Quote:
I don't think I'll be dabbling with this freak of an rdbms again...
Your loss. It's always good to have as many tools in your belt as possible.

Quote:
thanks, again,


.soma





Reply With Quote
  #7  
Old   
Lou Lesko
 
Posts: n/a

Default Re: newbie question: creating a new record in a related file - 07-31-2003 , 12:43 AM



"somaBoyMX" <nosuch (AT) fakemail (DOT) net> writes:

Quote:
I don't think I'll be dabbling with this freak of an rdbms again...

thanks, again,

Oh whatever!

loulou


Reply With Quote
  #8  
Old   
JC
 
Posts: n/a

Default Re: newbie question: creating a new record in a related file - 07-31-2003 , 02:59 PM



Maybe the solution will more easy if you make a script that copy the ID
CLIENT (client database) , then perform an external script in the INVOICE
database that makes a new record and then paste the ID CLIENT in the ID
CLIENT field (invoice database).

Also the solution made by Bill is also a solution but the only thing you
have to do is to put a little button (right side p.e.) in the portal with
the script "go to related record".

regards and sorry for my english.

Juan

"somaBoyMX" <nosuch (AT) fakemail (DOT) net> escribió en el mensaje
news:3f27bb47$0$273$ba620e4c (AT) reader0 (DOT) news.skynet.be...
Quote:
You can do it with a Portal in the Contacts file. First, the
relationship from the Contacts file as Master to the related Invoice
file has to be defined to allow creation of related records. See File
Define relationships in the Contacnts file to do this. Then put a portal
from the Invoices file into a layout of the Contacts file. Put suitable
fields from the Invoices file into the portal, such as date, amount,
etc.

Now when you go to the portal, click in the first empty row, and enter
data. That will create a new related Invoice record, related to the
contact. Done. No need for a script.

Bill

Thanks for the help Bill, very useful. But I think I wasn't specific
enough.
I need users to be able to:
* click somewhere in the contacts file (perhaps a button that says: <<make
new invoice for customer>>)
* the invoice file should automatically open, showing a new record tied to
the contacts record
* the user then can fill out this invoice and print it immediately in the
layout specified in the invoice file

I know your way will work, but then the user would need to open the
invoice
file, search for the record and print it.

Any hints?






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.