AnsweredAssumed Answered

PHP setRelatedSetsFilters Does Not Work

Question asked by tduell_1 on Dec 6, 2011
Latest reply on May 10, 2016 by TSGal

Summary

PHP setRelatedSetsFilters Does Not Work

Product

FileMaker Server

Version

11

Operating system version

OS X or Windows

Description of the issue

I believe there is a bug with the PHP engine. I don't believe the function setRelatedSetsFilters works. No matter how I program the code to find the record(s), then filter the portal based on the Portal Setup dialog box for Sort portal records, it simply does not filter the portal records. I've had to resort to either forcing the portal to do what I want via the Table Occurrence, which means extra fields and extra TOG's, or using the Privilege Sets to filter the portal based on user Privileges. Here's an example of 1 of the snippets of code I tried (I tried many different ways to do this). What I'm doing here is navigating from a list page to a detail page using getRecordByID. Then I'm storing the related records in the $related_records variable. Next, I'm applying the filter on the layout. Finally, I'm displaying the related records using a foreach loop.

<?php
$record = $fm->getRecordByID("LayoutName", $_GET['id']);
$related_records = $record->getRelatedSet('related_data');
$related_records->setRelatedSetsFilters('layout', 10);
foreach($related_records as $related_record)
{
$table_data .= '' . $related_record->getField('related_data::Text') . '';
$table_data .= '

';
}
?>

I have also tried performing a direct search using the newFindAllCommand, then filtering the related records, finally executing the request. That does not work either. So I'm at a loss after so much trial and error that I believe the setRelatedSetsFilters does not work,

Steps to reproduce the problem

See description for code. I'll be more than happy to provide you with a sample database and code to test if you contact me.

Expected result

The related records should only show the records based on the filter for the Portal Setup.

Actual result

No filter is applied.

Exact text of any error message(s) that appear

No errors.

Workaround

The only workaround is to use a specific TOG or Privilege Set to filter the records.

Outcomes