June 5, 20187 yr Newbies Hello, I'm new to FM and Custom Web Publishing. I'm playing with PHP and I after various days of searching I can't figure how can get the value of a summary field in a found set. This is the code I'm actually using, this code get the value of one record, not the value of all found set. (Excuse my English....) "Total Sales" is the summary field. Any help please? Thank you very much. $findCommand = $fm->newFindAnyCommand("MyLayout"); $findCommand->addFindCriterion("Year", "2018"); #$findCommand->setRange(0, 1); $result = $findCommand->execute(); if(FileMaker::isError($result)){ echo($result->getMessage()); return; } $record = current($result->getRecords()); $totalsales = $record->getField("Total Sales");
June 5, 20187 yr On first examination, the code looks ok, but recreating the query reveals that "newFindAnyCommand" doesn't produce a result for Summary fields. It also doesn't make sense to find just one record and then add an additional FindCriterion. Suggest using "newFindCommand" instead. For what is worth, I have always just generated summary totals on the fly during foreach loops, like this: $records = $result->getRecords(); foreach ($records as $record) { $totalSales = $totalSales + $record->getField("Sales"); } echo $totalSales; Hope that helps.
Create an account or sign in to comment