First, you'd need a self join relationship between your customer table and a second table occurrence of the same table.
Customers::anyfield x Customers 2::anyfield
IF the layout refers to customers and the portal to customers 2, then this go to related records step will pop up the specific record as the current record for the layout so that your fields outside the portal can display the detail info:
Go To Related Record [From table: Customer 2; Using layout: <Current Layout> ]
Thanks for the reply.
But I do not wish to view the selected customer details via pop up using Go To Related Record method.
I need the customer details to display within the same layout beside the portal when i select the customer in the portal.
For example, i click on portal row 3 with the customer name John. Then i immediate can see that the customer John details such as email and other details beside the portal within the same layout.
After much thoughts, it seemed like I had to create another table to act as a temporary holder for the selected portal row of customer details. So whenever a portal row is selected, it will trigger a script to copy the customer details over to the temporary table record to be displayed on the layout beside the portal.
And any changes to this temporary record will also trigger a copy over to the customer portal to update the record.
Otherwise i can't think of any other way as of now.
You don't need another table to do this. The instructions from PhilModJunk will do what you require all on the same layout. It's just an unfortunate choice of words - "pop up" - he has used that seems to have led you to your present situation.
I used my method mentioned above - writing a couple of scripts to handle the copying here and there as well as creating new portal row... and it works successfully though it takes a few hours of effort to code and test.
Mmm... as for PhilModjunk method i foresee a problem as i'm not using Customer and Customer 2, but Company and Customer where the Customer portal reside on Company layout. So i think having a Customer 2 also on Company layout is unlikely to work.
You last post shares details not present in your original post.
You appear to have:
If you change that to:
SelectedCustomer::__pkCustomerID = Company::gSelectedCustomerID
Company::__pkCompanyID = Customers::_fkCompanyID
For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained
SelectedCustomer is an occurrence of the Customers table, you can then use this script to display the details for a customer when you select it by clicking a button in the portal row of your customers portal:
Set Field [Company::gSelectedCustomerID ; Customers::__pkCustomerID ]
If you then add your detail fields from SelectedCustomer directly to the layout, they will show the details for the selected customer after you click the button in the customers portal. (And the entire row of fields can be set up as a button to click.)
Keep in mind that you still have just the two tables, but use three Tutorial: What are Table Occurrences? to get the relationships needed to make this work.
Sorry, one last question. Is there an elegant way (like the above) to insert new portal row via a button?
This is my last step to complete the solution.
Search Internet and it says goto last portal row and set field and it will insert new portal row. Somehow it doesn't work. I'm using FileMaker Pro 12 Advanced.
Found from Internet that I have to turn on creation of child record in database relationship in order for the goto last record and set field to insert a new portal row. If I don't turn that on,it will not work. And I had to rely on the scripting approach of having a new window,goto child layout, create new record, set field for parent_id andd then close window.
That works, but it's one of three ways I know of to do this.
Another way is this script:
Set Variable [$Key ; value: LayoutTable::PrimaryKey ]
Go to Layout ["portalTable" ( Portaltable ) ]
Set Field [Portaltable::ForeignKey ; $Key ]
Go to layout [Original layout]
If you set the right sort order on your portal, this can cause a new blank record to appear at the top of your portal.
But watch out for any script triggers that might be tripped by the layout changes as they might interfere with the desired results.