3

The only way I can see to get a total record count necessary for setting up some sort of pagination mechanism would be something like:

$fileMakerObj = new FileMaker( /* credentials redacted */ );  
$fc = $FileMakerObj->newFindCommand('someLayout');  

//Get max Record count for someLayout 
$fc->setRange(0,0);  
$result1 = $fc->execute();  
$maxRecords = $result1->getTableTotalCount();  
$fc->clearRange();  

//Window 0-100 of $maxRecords  
$fc->setRange(0,100);  
$page1 = $fc->execute();  
//Repeat as necessary  

Is there something I am missing, or is this the only solution?

hakre
  • 193,403
  • 52
  • 435
  • 836
David
  • 17,673
  • 10
  • 68
  • 97
  • What are you trying to count? Records in a table or a found set? – Ted Oct 21 '10 at 08:02
  • Most likely the found set. I ended up going with the original solution, but curious if there is a better way then scanning through the set to get the total count. – David Oct 21 '10 at 08:18

1 Answers1

4

One minor but important change:

if you set

$fc->setRange(0,0);

to get the RecordCount, you actually don's set a range and scan through the set. If you use

$fc->setRange(0,1);

instead, you only read one record. Then use

$result1->getTableRecordCount();

to get the record count in the unterlaying table or

$result1->getFoundSetCount();

for the count of the filtered records.

Martin M
  • 8,430
  • 2
  • 35
  • 53
  • Not exactly an answer but it does improve on getting row counts, re-marking yours as correct answer. – David Apr 27 '13 at 19:05