Jump to content
The ORIGINAL FileMaker Community - Forum - Online Business Apps & Software Forum
mbootsman

Get recordcount

Recommended Posts

mbootsman

Hi,

 

I want to get the total amount of records.

I have this code:

$fm = new FileMaker();
$fm->setProperty( 'database', $filemaker_db );
$fm->setProperty( 'hostspec', $filemaker_host );
$fm->setProperty( 'username', $filemaker_uname );
$fm->setProperty( 'password', $filemaker_pwd );

$request = $fm->newFindCommand( $filemaker_layout );
$request->addFindCriterion( 'Email', '*' ); // find records with non empty email fields

$result = $request->execute(); // this gives me all records - not just the count

What do I need to do to get a record count, and not all the records?

getFetchCount() only works when I set a range with setRange(), otherwise I get an error: "XML error: No memory at line 1".

Help is appreciated. Thanks.

Share this post


Link to post
Share on other sites
Steve Martino

Are you talking about getting the found count, the number of records in your found set and displaying it on a layout?  I'm quite confused by your code.

If so, you can simply use the formula  Get(FoundCount).

I've use variations of this with Insert>Other symbols:

{{RecordNumber}} of {{FoundCount}} / {{TotalRecordCount}}

to display:

1 of 355 / 455

You can also highlight everything including the inside brackets, set the font for 1 pt. to save space, so it would look like this:

{{RecordNumber}} of {{FoundCount}} / {{TotalRecordCount}}   //Could only do 8pt on this site, but you get the idea.

Share this post


Link to post
Share on other sites
mbootsman

Hi Steve, thanks for your reply. I left out some details in my post.

I'm using the FM API for PHP Standalone to communicate with a FM server. I am building a custom synchronization plugin for WordPress, and I'd really be helped if I could get the total number of records from the layout that matches the criterion (have an email that is not empty).
 

Share this post


Link to post
Share on other sites
doughemi

Use

$records = $result->getRecords();
$count = count($records)

. Unfortunately, the API will download the records regardless. One way to minimize the bandwidth is to work on a layout with only one field
(in this case, Email).

Edited by doughemi
Corrected code
  • Thanks 1

Share this post


Link to post
Share on other sites
mbootsman

Thanks, haven't thought about creating a new layout. Will ask the FM administrator to do that.

 

Share this post


Link to post
Share on other sites
This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Terms of Use