[FX.php List] Showing last related record - sort in FM or just PHP?

DC dan.cynosure at dbmscan.com
Mon Oct 16 17:34:30 MDT 2006


the fmp wpe doesn't care if you put related fields in a portal or  
not; it will return all related records to the FX.php result data  
whether you put the related field in a portal or not. so, putting a  
related field in a portal doesn't modify the data set.

my best advice, sort in fmp in the relationship definition. if you  
want to get really trick and you are sure you only ever need one  
(most recent) record you can make a calc field that just returns the  
last record. that way PHP doesn't have to transform a bunch of XML  
data that you'll never use.

however, there is a potential flaw in that the most recently created  
record may not be the one you want to display. that is, if you have  
some reason to have to force creation of a record after the fact you  
may end up displaying the wrong record because your sort order wasn't  
determined correctly (logically defined using some other method  
rather than creation date). my advice is to use some other sort  
definition like a separate field that you can modify to define the  
sort order of your records explicitly.

dan

On Oct 16, 2006, at 6:22 PM, Joel Shapiro wrote:

> Hi all
>
> I need to pull the last (most recent) related record for each of a  
> set of found records.  I'm wondering about the best / most  
> efficient way to do this.
>
> (a)
>   - create a relationship in FM that sorts in reverse order,
>   - place related fields on web layout -- No portal
>
> (b)
>    - create a relationship in FM w/ no sort order,
>    - place portal (w/ fields) on web layout,
>    - in php, don't use foreach, so display only last returned (or  
> use sort() in php)
>
> It seems like a choice between needing FM to sort each found  
> record's related records (before sending to the web), VS. pulling  
> in potentially a lot of related records per each found record, only  
> to need just the last of each.
>
> I'm guessing it's better to sort in FM (option a) and just pull one  
> related record for each parent found, but does anyone have  
> experience w/ this (or an opinion ;) ?
>
> Notes:
> - I can't just find the related child records because some of the  
> found parent records may not have child records, and I need to show  
> them anyway.
> - Most queries will pull fewer than 10 parent records, though a few  
> may find around 40.
>
> TIA,
> -Joel
>
>
> Joel Shapiro - FileMaker Pro Database Design
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
> joelshapiro at jsfmp dot com
> http://www.jsfmp.com
> 415-269-5055
>
>
> _______________________________________________
> 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