Solved

show 'X' amount of records from a related set

Posted on 2009-04-14
3
944 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now