You cannot set up a portal to have the add row appear at the top, but you can use a set of (usually global) fields postioned at the top of your script with a script that uses the data to create a new record in the portal's table that contains the data entered into this set of fields.
Let's pretend that your portal is based on this relationship:
Main::__pkMainID = Portal::_fkMainID
and that there is only on other field in Portal, Name.
Add a field to your database named gName and give it global storage. Global fields can be accessed from any script and from any layout in your file so you can define it in Main or in its own special table of global fields. We'll put it in Main just to keep things simple.
Position Main::gName at the top of the portal and put a button next to it for adding data from gName to a new record in Portal.
It can perform this script:
Set Variable [$$TriggersOff ; value: True ]
Set Variable [$PK ; Main::__pkMainID ]
Go to Layout ["Portal" (Portal)]
Set Field [Portal::_fkMainId ; $PK ]
Set Field [Portal::Name ; Main::gName ]
Go to Layout [Original Layou]
Set Variable [$$TriggersOff ; value: False ]
Scripts that change layouts can trip a number of script triggers. The scripts performed by such script triggers can slow execution and can interfere with the correct execution of your script. To keep them from interfering, you can write any trigger controlled script like this:
If [ Not $$TriggersOff ]
#Put rest of script steps here
This allows you to use the global variable $$TriggersOff as a switch to disable trigger controlled scripts, but only if you write the scripts so that they check the value of this variable.