Solved

show 'X' amount of records from a related set

Posted on 2009-04-14
3
948 Views
Last Modified: 2012-08-14
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
Comment
Question by:sam_thwaites
  • 2
3 Comments
 
LVL 28

Expert Comment

by:lesouef
ID: 24148527
break the loop when you reach 5 records?
0
 

Author Comment

by:sam_thwaites
ID: 24149276
I'm not sure how to break a loop, can u please show me some example code. Thanks lesouef
0
 
LVL 28

Accepted Solution

by:
lesouef earned 250 total points
ID: 24149460
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question