January 28, 20169 yr I'm performing some find operations that I only want to get the total number of records returned for display purposes, and don't need to return any records. I've tried using the following: $max = 0; $skip = 0; $request->setRange($skip, $max) $result = $request->execute(); but this looks like it's returning all the found records, not zero records. I had assumed 0 was a valid value for $max but it appears this isn't so. Anyone have any experience with this or know a way to return zero records but still be able to call getFoundSetCount() to get the total number of found records?
January 28, 20169 yr You don't need to display found records, so I'm not sure I see the point... You can just perform the find and get the record count
January 28, 20169 yr Author 26 minutes ago, webko said: You don't need to display found records, so I'm not sure I see the point... You can just perform the find and get the record count Hi webko, Thanks for your reply. My issue is that if I set $max to 0 then it returns all matching records in the result, which at a certain point will return a 500 server error as it's run out of memory.
January 28, 20169 yr Can you create a FM script that does the find, and sets a global field with Get(FoundCount)? Then you could use a newPerformScript() call in php, and then pull just the one field with a newFindAny() call.
January 28, 20169 yr Also... How many records are potentially being returned? On a tuned layout (i.e., with only the fields needed for the -find) I can return 10,000+ without error
January 28, 20169 yr Or another tack would be to create a layout with only the fields involved with the find, and query that. Oops, that's what webko just said! Edited January 28, 20169 yr by doughemi
January 29, 20169 yr Author 2 hours ago, webko said: Also... How many records are potentially being returned? On a tuned layout (i.e., with only the fields needed for the -find) I can return 10,000+ without error It's returning thousands of records potentially - it was working fine with just hundreds. I've changed the max to 1 and created special layouts for these finds and that has fixed the problem for now. I wish the API didn't return the meta data/data for all the found records until you requested them - just the number of records found and any errors etc.
Create an account or sign in to comment