If you have a layout based on Table A, and you put a portal on it from Table B, your relationship should be:
PrimaryKeyA (auto-entered, no modify on Table A) connected to ForeignKeyB (foreign key in Table B, regular text or number field to match PrimaryKeyA)
A record can only show in the portal, when Table A PK, matches Table B FK. So If you have a customer, John Smith, and his primary key is 56, then all the related sales records have to contain 56 in the foreign key on table B or the records wont be related.
There are a few ways to populate this key, so let me know if you need more info.
The issue, however, with that solution is that I am trying to display a portal filled with a certain type of product - meaning that the table that I want to display in the portal needs a primary key field. You suggested that the other table layout, which I will put the portal on, needs a primary key as well, and then it should be linked to a foreign key of another table. How do I do this if both tables need primary keys?
Every table needs a primary key. A primary key in a parent record will be related to many child records that contain the same number (or text) in their foreign key
In the relationship tab in manage database, you will link the primary key in the parent table, to the foreign key in the child table. On the child side of this relationship you can check the box 'Allow creation of records in this table via this relationship', and you will be able to add new records in the child table in the portal.
On the parent record layout, you will add a portal. That portal set up will ask you at the top 'Show Related records from' dropdown and you pick which table you want to show the records from. If the relationship isn't set up in manage database, then it will be grayed out in the dropdown.
So, if everything is set up properly, your good to go. Now if you want records to show up in the portal, they will automatically have (should have) an auto entered serial number. But, you need to populate the foreign key with the same number that is in the primary key on the parent relationship.
Ok, so once everything is set up properly, we can tackle this issue:
I am trying to display a portal filled with a certain type of product
So now it would be best to describe in exact words what you have. What's in the parent table, what's in the child table, and what 'product' you want to show up in the portal, and I (we, somebody) can help you some more.
I just did (I think) exactly what you said and I'm still having issues. My parent table is the "Kits" table. A "kit" is a collection of products. I have 7 child tables for each type of product, as they are very different, and my goal is to be able to select records from each one of these product tables and put them in the kit table as a record (via portals). I understand and have written the scripting necessary to do this, I just really can't figure out this portal issue.
Your latest post is different from you first post. Now you wish to pull products into the portal from 7 different tables, or into 7 different portaIs? I think it would be best to show a picture of your relationship graph, and explain what table or table occurance is the portal based. The portal will only show the record the relationship and/or filter is based on
My reason for phrasing my first post the way I did was because I figured if I could format the portal properly one time, I'd be able to simply replicate the process for the rest of my ten* tables. Anyways, hopefully the screenshot and the below will clear things up.
The "Kits" table is the parent table. Each "Kit" contains information drawn from records from the ten "Product" tables (each product is very different, which is why I organized them into ten different tables). On the layout associated with the "Kits" table, I have ten portals, each (hopefully) should display the records associated with the table the portal displays. I then configured a button that goes over each record that the portal displays. The button executes a script that extracts the needed information from the record on the portal and puts it in its proper place in the "Kits" layout. Ideally, then I would be able to select a product from each product category, the information I would need then be extracted and put into the current record of the "Kits" layout, then on an invoices page, I would be able to select a kit (in addition to a standalone product). It seems like I'm not creating relationships properly. To put it bluntly, I have absolutely no idea how to get the portal to display the records associated with each table.
I'm sure you are on the right track. Id have to play around with a sample to help you further. Considering all the Products tables seem to contain all the same attributes, I wonder if it would be easier (not necessarily better) to have all the products in one table, with one of the attributes being Category. The records would be sorted by Category, then Product Name.
Then a standard relationship like one in Invoices would apply. Where you have:
Kits-------<LineItems>---------------Products would apply, where Kits would be the layout, LineItems would be the join table & portal on the layout, based on products. Then it would be easier to populate the kits with dropdown fields, driven by a conditional value list. So the first dropdown would be Categories (you see all categories), select say Water Pumps. Then the next dropdown would only show the water pump products. These could be on a popover or picker window, depending on version, so the user selects Category, then the product, and it adds it to the LineItems portal on the Kits layout.
Here's a simple Invoice DB. You can pick it apart to see how the record gets populated, and how the line items (in your case Kit components) get populated. If it needs a PW, U/N Admin, PW 1234. Unzip first
Alright I completely replicated the above in my solution and it did not work. I've spent so much time on the issue I'm about ready to snap my computer in half. Who can I pay to walk me through this on Skype or something?