AnsweredAssumed Answered

I want to group my product report search results by the product ID

Question asked by dylancothill on Apr 26, 2016
Latest reply on Apr 27, 2016 by keywords

Hi all,

 

I am finishing off an API setup with Wordpress and FileMaker whereby the client searches for a product report by ProductID and date range.

I have completed all of the coding and it all works like a charm using the following on the results (the "xxxxxx" denotes the rest of teh coding in the results not important for this question):

// display records
  $records = $result->getRecords();
  foreach ($records as $record) {

  // get data
  $productID = $record->getField('pf_Product');
  $date = $record->getField('Date');
xxxxxx

// show data
  echo "Product ID: $productID<br>";
  echo "Date: $date<br/>;
xxxxxx
}

 

What I now need to do is take the results and group them by the Product ID as there are cases when they will search by "All Products", how best do I achieve this? I already have the serach part and results showing for all products, but now I just want to group them by ProductID. I would like to do this for all search results.

 

Any help would be much appreciated so that I can finish this project off.

 

Thanks

Outcomes