To count the records in portal, in the main table layer, if I just use the script as simple as :
Count (RelatedTable :: AnyFieldName)
As long as the field is not empty, the result will be exactly the count of records?
If your portal is not filtered with a filter expression, and the field specified is not empty for any of the related records, yes.
That function counts the number of related records where the specified field is not empty.
For filtered portals, you can use a summary field placed inside a one row copy of the filtered portal. ( must have same filter expression. )
Retrieving data ...