And why/how would it be able to do that?
We'd need to see the script and understand what relationships you have in place between your layout's table and the two portal tables before we can suggest how to get this to work for you.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
- If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
maybe i can just put up the screenshot of my work, instead. here...
The grey boxes at the bottom are called table occurrences. On which is your layout based? (This is selected in Show records from in layout setup...)
On which table occurrences are each of the two portals based?
I can guess that portal 1 would specify "Suppliers" in Show Related Records From in Portal setup.... and that portal 2 would specify "Purchases", but need to be sure.
portal 2 should show related records from Purchases that a certain supplier sold.
Yes, you are correct.
Can you help me? Please...
You are linking Suppliers to purchases by supplier name. I strongly recommend that you change that to link by a serial ID number instead. Companies change their names and that name change can cause problems for you that can easily be avoided if you don't use the name to link records. (If and when you make such a change, we'd need to modify the rest of the instructions in this post to substitute the number field for the supplier name fields.)
You also did not tell which table occurrence is the basis for your layout. I will assume that "Show Records from" lists AccPayments. You'll need to modify my instructions if this is not the case.
Working with what you have at this time, make a new occurrence of Purchases. In Manage | Database | relationships, make a new table occurrence of Purchases by clicking it and then clicking the duplicate button (2 green plus signs). You can double click the new occurrence box to get a dialog to appear where you can rename the new occurrence box to something such as SelectedSuppPurchases.
We have not duplicated a table. Instead, this is a new reference to the same table already present in your database.
Add it to your relationships like this:
AccPayments::gSelectedSupplier = SelectedSuppPurchase::PSuppName
Make gSelectedSupplier a new field in AccPayments with global storage specified.
Place a portal to SelectedSuppPurchase on the second tab.
Make your portal fields in the first portal a button that performs this script:
Set Field [AccPayments::gSelectedSupplier ; Suppliers::SuppName ]
Go to Object ["PurchasesTab"]
Before you try out that script, select the Purchases tab while in layout mode and give it "PurchasesTab" as an object name by entering this text into the Name box at the top of the Inspector's position tab.