Solved

show 'X' amount of records from a related set

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FM - Phantom MIssing Field in DDR? 5 121
FMP auto filed input? 3 123
Filtering portal results 3 76
FM - How to Tell if a Container Field is Empty 4 121
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…
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…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 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

14 Experts available now in Live!

Get 1:1 Help Now