• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 961
  • Last Modified:

show 'X' amount of records from a related set

How do you show only the first 'X' amount of records from a related set on the web using filemaker API PHP?

I have 20 records in the related set, however I only want to display the last 5 records. On my filemaker web layout the related set portal is set to view only 5, with scroll bar inactive.

Currently the web outputs all 20 records in the related set.
Using function: 
 
$relatedset = $xxx->getRelatedSet("TABLE");
 
<? foreach ($relatedset as $record) {
 
echo $record->getField("TABLE::name_item");
 
} ?>

Open in new window

0
sam_thwaites
Asked:
sam_thwaites
  • 2
1 Solution
 
lesouefCommented:
break the loop when you reach 5 records?
0
 
sam_thwaitesAuthor Commented:
I'm not sure how to break a loop, can u please show me some example code. Thanks lesouef
0
 
lesouefCommented:
you need to count the records for instance:

$count = 0 ;
<? foreach ($relatedset as $record) {
 echo $record->getField("TABLE::name_item");
      $count++ ;
      if ($count == 5) break ;
} ?>
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now