I have found the solution for counting filter rows creating a new portal with just 1 row. This new portal is filtered in the same way as the portal to be counted. Inside the new portal is placed a summary field counting the IDkeys from the child table. This works just fine.
However, I need this count result to be a variable in a script. Is there a simple way to do this?
What I am trying t do is this:
If ( valuecount ( GLOBALS::Some_global_field ) < $portalrowcountvariable )
Then do something...