Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Trouble with the concepts here


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

Recommended Posts

Posted

I just don't understand why or how portals and relations works. I want to make a simple Client / Product model, where Client is a Table, and Product is a Table.

Client and Product both should have a field called ProductID, The Client::ProductID is linked via a Relationship to the Product::ProductID.

In addition, Products keep track of the the clients that have selected this product. Therefor each Product keeps track of a ClientID, in the same fashion the Clients keep track of the products.

So all I should have to do is this...

1) make the appropriate relations in Define Database (ProductID/ClientID)

2) Create a Portal in the Clients layout that link ProductID

3) Create a Portal in the Product layout that links ClientID

4) create a script to add data to the portal (no clue on this one)

I really think I'm missing a step here, even though this seams simple enough. I'm going to go back and look at the tutorial that came with the program, but any input is appreciated.

I need to figure out how to add data through portals as well, so I can make a script that adds clients or products.

Thanks for the help

Posted

You must have three tables:

Client with Client_Id,Client_Name fields

Product with Product_Id,Product_Name fields

Product_Client which joins two files(Client,Product) with Client_Id,Product_Id fields

This relation is "many to many" relation

In the Client Tabel you must create portal to third table on Client_Id field

In the Product table you will create portal to third table on Product_Id field

If you will have questions i can post details

Posted

aaa has given you a possible structure (though I would rename Product_Client to be Line_Item, and add an Invoice table between Client and Line_Item, so that a Client could have multiple Invoices, and an Invoice could have multiple Line_Items.)

Usually relationships between tables are one-to-many, where each record on the "one" side links to "many" records on the many side, via the primary ID on the "one" side. So a Client record (with ID 1234) might be related to 3 invoices, if each of those invoices has ClientID 1234.

To build these relationships, you go into File->Define->Database, in the Relationships tab. You will see a Table Occurance (a box) for each table. Simply drag a line from the primary ID of one table occurance to the corresponding ID in another table occurance. So for Client to Invoice, drag a line from the ClientID field in Client to the ClientID field in Invoice. If you make a mistake, you can select a line and delete it, or double click it to change the fields. See attached diagram.

You can view these related records through a portal of Invoices on a layout based on the Client table. Likewise, you can view all the Line_Items or Invoices, where a specific Product is used by having a portal of Line_Items (or Invoices) on a layout based on Product.

To be able to add Line_Items to an Invoice, you can use a portal of Line_Items on a layout based on Invoice, then make sure the option to allow creation of related records is on for that relationship (In File->Define->Database, in the Relationships tab, double click the line between Invoice and Line_Item, and check the option to Allow creation of related records on the Line_Items side.)

I'm afraid there are a lot of details to making a good relational database, and this is only a start. You may want to invest in a FileMaker 7 book or a training class (or both.)

Client-Product.GIF

Posted

MrRage: You add data to the related table in the last row of the portal; the key will automatically be written.

Posted

So the idea of relations is not like a field holds tables, instead an abstraction of tables and fields working together.

Its just a difficult concept for me to grasp, I'm a C++ programmer and FileMaker Pro 7 isn't very intuitive with the background I have. With a little more tinkering around and reading I'm sure I'll get the concepts soon enougn.

Posted

A relationship links records in two tables together. Try experimenting with simple examples so you understand what's going on.

This topic is 7269 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.