I can't find how to script the button to change the active tab.
Enter layout mode.
Click the tab control once to select the entire tab control.
Click the specific tab panel for the detail portal to select it.
Now enter an Object Name in the Name box found at the top of the Inspector's position tab.
Now the script step: Go to Object can be used to select that tab panel if you enter the exact same name into this script step.
How do you add to a different table?
Assuming that your layout is based on a table named Invoice...
Set variable [$ID ; Invoice::__pkInvoiceID //use your field name for the primary key instead of mine]
Go to Layout ["Line Items" (Line Items )]
Set Field [LineItems::_fkInvoiceID ; $ID ]
Go To Layout [original layout]
Go to Object ["specify name of desired tab panel here"]
"Go to Layout ["Line Items" (Line Items )]"
But the detail table is displayed in a protal on the same layout as the header file. Do I have to use 2 different layouts?
You don't absolutely have to, but it makes for much simpler scripting and the script is a bit less sensitive to the current design of your layout.
If you don't use that method, you have to enable "allow creation" for the portal in it's relationship to the layout's table and your script must use go to portal row [Last] to put the focus in the bottom 'add' row of this portal. Then Set Field can populate a field in this portal row to create a new record. But this, IMO, is much less desirable than using the change in layouts.
Ok, that's what I'll do. Thanks so much for your help.
This is a great forum to quickly get help from knowledgable users.