[FX.php List] Display a Rlated list of records

Joel Shapiro jsfmp at earthlink.net
Mon Oct 16 12:07:48 MDT 2006


OK, my bad, Andy.  I was just guessing on that one, and clearly  
didn't really look at it.  I've never used count() but I see now how  
your example does indeed make sense.  I've always used a while loop.
Thanks for correcting me.
-Joel


On Oct 16, 2006, at 10:58 AM, Andy Gaunt wrote:

> Joel,
>
> Just a quick point.
>
> I actually did not leave out the $counter on the count.
>
> If I had placed it there it would count just the first row.
>
> The count needed to count the total for the portal so therefore it  
> just
> needed to reference the relationship and the relevant field.
>
> I should have included a while loop too though so well done on that  
> end.
>
> Andy Gaunt
> Office: 321.206.3658
> Mobile: 407.810.4722
> andy at fmpug.com
> http://www.fmpug.com
>
> 2006 FileMaker Excellence Award Winner
> Recipient of FileMaker's 2005 "Mad Dog" Public Relations Award
>
> For chapter locations, dates & times please visit the website at
> http://www.fmpug.com If you can make it to a meeting, please RSVP at
> http://www.fmpug.com/rsvp.php
>
> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org
> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Joel  
> Shapiro
> Sent: Monday, October 16, 2006 1:40 PM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] Display a Rlated list of records
>
> d'Oh!  I had 2 stray )s in my example (from copying from one of my
> pages)
>
> Should be:
>
> $prow = 0;
>
> while(['YOURRELATIONSHIP::FieldA'][$prow]) {
> 	echo $value['YOURRELATIONSHIP::FieldA'][$prow].'<br />';
> 	$prow++;
> }
>
>
> -Joel
>
>
> On Oct 16, 2006, at 10:33 AM, Joel Shapiro wrote:
>
>> Hi Gerry
>>
>> Have you included [$counter] after your field name?  Andy mentioned
>> that in his //comment, but seems to have accidentally left it out
>> of his example.  I believe it should be:
>>> for($counter=0; $counter < count($value['YOURRELATIONSHIP::FieldA']
>>> [$Counter]); $counter++) {
>>> //display your portal data here
>>> //Just remember instead of using the trailing zero you now use
>>> $counter
>>> // e.g. echo $value['YOURRELATIONSHIP::FieldA'][$counter];
>>> }
>>
>> Or you can use a while loop, like this:
>>
>> $prow = 0;
>>
>> while(['YOURRELATIONSHIP::FieldA'][$prow]) {
>> 	echo $value['YOURRELATIONSHIP::FieldA'][$prow])).'<br />';
>> 	$prow++;
>> }
>>
>> Just make sure, like Andy said, that FieldA will contain data in
>> every record.
>>
>> HTH,
>> -Joel
>>
>>
>> On Oct 16, 2006, at 4:37 AM, gerry.charest at agfa.com wrote:
>>
>>> Thanks Andy,
>>>
>>> This is where I started, using "count" but, each time it returns
>>> one and no more, even if the portal contains several records. I
>>> thought I was doing something wrong.
>>>
>>> Has anyone seen issues with count in the past. The portal is a new
>>> addition to my layout?
>>>
>>> Best
>>> Gerry
>>> <graycol.gif>
>>> ">"Andy Gaunt" <andy at fmpug.com>
>>>
>>>
>>> <ecblank.gif>
>>>
>>> <ecblank.gif>
>>>
>>> "Andy Gaunt" <andy at fmpug.com>
>>> Sent by: fx.php_list-bounces at mail.iviking.org
>>> 10/13/2006 11:34 AM
>>> Please respond to andy; Please respond to "FX.php Discussion List"
>>>
>>> <ecblank.gif>
>>>
>>>
>>> To:	"'FX.php Discussion List'" <fx.php_list at mail.iviking.org>
>>> cc:	(bcc: Gerry Charest/MJVYN/AGFA)
>>> Subject:	RE: [FX.php List] Display a Rlated list of records
>>>
>>>
>>> Gerry,
>>>
>>> Your portal data is in its own array within the FX array at large.
>>>
>>> The records begin with zero and count up.
>>>
>>> This means you can use a simple for loop to display the portal
>>> data as and when it is needed. All you need is a field that
>>> contains data for each row (like the record serial number)
>>>
>>> You can also check if the portal contains data using a count
>>> function.
>>>
>>> Try this;
>>>
>>> //FieldA in this example must contain data for the record (eg a
>>> required field such as an incremental serial number
>>> $countPortal = count ($value['YOURRELATIONSHIP::FieldA']);
>>> if $countPortal >0) {
>>>
>>> for($counter=0; $counter < count($value
>>> ['YOURRELATIONSHIP::FieldA']); $counter++) {
>>> //display your portal data here
>>> //Just remember instead of using the trailing zero you now use
>>> $counter
>>> // e.g. echo $value['YOURRELATIONSHIP::FieldA'][$counter];
>>> } }
>>>
>>> HTH
>>>
>>> Andy Gaunt
>>> Office: 321.206.3658
>>> Mobile: 407.810.4722
>>> andy at fmpug.com
>>> http://www.fmpug.com
>>>
>>> 2006 FileMaker Excellence Award Winner
>>> Recipient of FileMaker's 2005 "Mad Dog" Public Relations Award
>>>
>>> For chapter locations, dates & times please visit the website at
>>> http://www.fmpug.com If you can make it to a meeting, please RSVP
>>> at http://www.fmpug.com/rsvp.php
>>> From: fx.php_list-bounces at mail.iviking.org [mailto:fx.php_list-
>>> bounces at mail.iviking.org] On Behalf Of gerry.charest at agfa.com
>>> Sent: Thursday, October 12, 2006 2:25 PM
>>> To: FX.php Discussion List
>>> Subject: Re: [FX.php List] Display a Rlated list of records
>>> Hi All,
>>>
>>> I'm having a brain cramp today, perhaps some one can help me out.
>>>
>>> I have a list of records that each may have a group of related
>>> values returned from a portal. What I would like to do is display
>>> the portal data in a table, following the parent record data. When
>>> the portal has records it is visible when it doesn't it is not
>>> shown. I'm assuming I would use a foreach loop to display the
>>> portal records and corresponding html. But I just can't get my
>>> head around defining the foreach loop to iterate for the number of
>>> related records from the portal. Can someone give me a nudge with
>>> the MISSING SYNTAX?
>>>
>>>
>>> foreach ($searchResult['data'] as $key=>$searchData){
>>> //Parent Record Data display here
>>> foreach( "MISSING SYNTAX" ){
>>> //Child record data displayed here
>>> }
>>> }
>>>
>>>
>>> Thanks
>>> Gerry_______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>> <graycol.gif>
>>> <ecblank.gif>
>>> <pic07372.gif>
>>> _______________________________________________
>>>
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list