I have some data in a main table with one or more related rows in a portal. 1:M.
Since I don't know in advance how many rows might be in the related portal table, how do I create a report that will expand automatically to display all the portal rows (could be none or ten)?
Don't want to have each page of the report with potentially 10 blank portal rows if none are in there for that parent record.
Portals are UI elements, and are not meant to be used for printing. If the number of records exceeds the portal row count, that data will never be printed.
If 10 is the max, then that would be workable in output, setting the portal to 10 rows.
In a UI screen, you can set the portal to 1 or more rows and set an anchor to the bottom and top. When the window is sized larger, the portal grows, increasing the number of rows displayed.
The appropriate print path for this is a list view.
An unstored calculation field in the child table with the calc "get (FoundCount)" will return the number of child records based on the current relationship. You can use that in HIDE conditions.
As bdbd indicated, basing the report on whatever TO the "many" comes from, would be the best and safest.
For instance- based on the parent, a FIND on a child TO field would return any matching record in the child table, completely independent of the parent records.
The ONE time I uaed a portal in a printed report was for fixed size Daily Report, with the portal usage locked at five rows. I worked well in that scenario. Other than that, all reports are based on the child table.