I'm setting a portal to show related records from another table. The issue is that it always shows n+1 records, being the last one an empty one, that if clicked on it creates a new record on that table. Any ideas on how to avoid this?
The empty row is what happens when you have "allow creation of related records" turned on in the relationship definition.
Kinda. This is a feature - so that the user can see that there is a row available to enter data. I also find it annoying and ugly, but the most common work around is to use scripted portal adds. I don't like that either, because the user can't tab to a new row and enter data when a scripted add record isn't really needed.
So, I use conditional formatting to "hide" the missing row - I turn off "show field frames when records are active " remove borders from fields, and either use no fill, or a highlight color for fields that have data or are active fields. If the related record doesn't exist, then I the field blends in with the background. I also use a text box with conditional fill to hide other elements such as row delete buttons or labels.
I also add an instruction "Click here to add new" behind the field, then use conditional formatting to fill the field when it has data - that hides the instruction. Attached is a pic of what the end result looks like, in a simple one-field portal.
This also has the advantage of making things more intuitive for the user - so there is no delete button showing when there is no record to delete...
And this option is only needed if you intend to use the portal relationship to create via portals. If the relationship is being established other than via portal-creation, you can turn off that option without any loss of functionality.
Retrieving data ...