SysQuery::getTotal works fine, but the trick is how to handle temporary data sources where getTotal does not work:
recordCount = SysQuery::getTotal(formDataSource.queryRun());
recordCount = formDataSource.numberOfRowsLoaded();
Now recordCount contains the number of Records in the FormDataSource irrespective of the Tmp status of the data source. Of course the whole tmp-data source has been loaded in the process, which might be an issue in some cases.