Thanks Steve, thats what I need indeed.
However I cant seem to figure out the script that I need to connect with the button to add a new portal record....
You'll need to substitute your names for mine:
Set Variable [$ID ; LayoutTableOccurrence::PrimaryKey ]
Go to layout ["PortalTable" (PortalTable) ]
Set FIeld [ PortalTable::ForeignKey ; $ID ]
GO to Layout [original layout]
And note that any script that changes layouts could trip a number of different script triggers if such have been set up on either layout.
We choose to do this a different way and create years with months in advance so we only need to enter the data in the predefined rows.
I have attached an image how we would like the data to appear.
I have thought of a way to create this with portal records but could not find a way to predefine the 12 months and the 5 years (we would like to be able to add or remove years easily to all records) and link everything so we can use searches and compare rents etc.
AND is it possible to hide all this if the "status" field is NOT "rented" or something similair. In other words can you hide or not make fields, portal etc appear at all based on a calculation?
I wonder if you have a great way to do this? thanks in advance!
I would not use tabs for the years. There's no simple way to add more years with that approach and you have to redesign your layout each time you want to change the tabs.
But your portal can be controlled by a drop down list set on a field with global storage where you select and existing year or enter a new one. An OnObjectSave trigger can perform a script that creates the needed 12 records if they do not already exist.
If [ IsEmpty ( RelatedTable::Date ) // only true if portal is empty ]
Set Variable [$PrimaryKey ; LayoutTable::PrimaryKey ]
Go to Layout ["PortalTable" (PortalTable)]
Set Variable [$Month ; $Month + 1 ]
Exit Loop if [$Month > 12 ]
Set Field [ PortalTable::Date ; Date ( $Month ; 1 ; LayoutTableOccurrence::GlobalDropDownYearField ) ]
Set Field [ PortalTable::ForeignKey ; $PrimaryKey ]
Go to Layout [ original layout ]
The relationship for the portal might look like this:
LayoutTableOccurrence::PrimaryKey = PortalTable::ForeingKey AND
LayoutTableOccurrence::GlobalDropDownYearField = PortalTable::cYear
cYear would be a calculation field defined to return the year: Year ( Date )