AnsweredAssumed Answered

FMSA 11 - PHP - how to create a set of records by recid

Question asked by on Oct 15, 2013
Latest reply on Oct 17, 2013 by JonJ


FMSA 11 - PHP - how to create a set of records by recid

Your post

     In my PHP CWP solution, I need to recreate a set of records that has been defined elsewhere and stored as an array of record IDs (or primary key field values). The set could be as large as 500-600 records. They don't have any reliable common criteria I can use for creating a simple find -- they may as well be completely random.

     Getting the records one at a time using GetRecordByID is not feasible of course, because I'd have to hit the database once for each record. (How I wish that method could take an array as the ID parameter!)

     The only find request I can compose to create the set is a compound find request, searching a recid field (or primary key) and creating a new request for each record I want to get. I can do this easily by looping through my array of IDs, creating a new find request with each iteration, and then executing the find. This works, even for the large record sets (though slow), and I will probably end up using this method, but I'm wondering if anyone has solved this problem more elegantly.

     If I were doing this in FileMaker Pro, I would simply place the stored list of return-separated primary key values into a global field and create the desired found set via a relationship and the Get Related Records script step. But I can't conceive of a similar solution that would work in PHP.

     Any thoughts? Thanks!