[FX.php List] Portal vs 2nd query [Was: Related Records]
Joel Shapiro
jsfmp at earthlink.net
Tue Mar 21 13:09:06 MST 2006
Let me see if I understand:
A business has two contacts, Joel and Derrick. Joel has two phone
numbers and Derrick has one.
On a layout based on the Business table, I have a portal to the
ContactPhone records. When the portal is sorted by ContactID, the
rows would look like:
C12 555-1234 Joel
C12 555-1235 Joel
C14 444-2222 Derrick
You're saying that I could pull in these 3 related records via code
like your earlier sample:
> $prow = 0;
> while($value['Relationshipname::ID_Field'][$prow]) {
> echo $value['Relationshipname::Data_Field'][$prow];
> echo "<br />";
> $prow++;
> }
and then within the PHP break these 3 into their 2 respective
contacts -- kind of like a subsummary in FMP.
Is that right?
And this would be as opposed to pulling in the two contact records
separately from a portal of Contacts. Or would you do both?
If you have any code already written that does something like this,
I'd love to see it.
Thanks very much,
-Joel
On Mar 21, 2006, at 11:14 AM, Derrick Fogle wrote:
> In FM7/8, the relationship structure allows you to have a portal to
> a related table, and also show data from relationships that are
> farther down the line, or closer to the source table. One of my
> applications is a typical Many-Many relationship: each Job can have
> multiple Clients, and each Client can have multiple Jobs. So
> there's a join table in between that also has information about
> client roles and such.
>
> In FM, my layout is showing records from the Job. on that layout, I
> have a portal that shows all the related client link records from
> the linking table. But I'm only showing a couple fields from that
> particular table. The client linking table is, of course, also
> related to the client table, and most of what is seen in that
> portal is data coming from the client info table.
>
> It's not a portal in a portal, but it's actually pretty trivial to
> create that appearance in FX.php. In your instance, you need to
> create a portal on a layout whose native table is Business, that
> shows the ContactPhone table data. In that portal, you can also
> show the Contact data because it's in the relationship chain. So
> you have few extra Contact fields in the portal that shows
> ContactPhone, and that Contact data might be the same for all the
> portal records. Make sure the portal is sorted so that the contact
> information comes through in order.
>
> Once you've got this data in FX.php, use PHP variables to suppress
> the duplicated information in your loop. If you need some help with
> that code, let me know.
>
> Thanks,
>
> On Mar 21, 2006, at 12:37 PM, Joel Shapiro wrote:
>
>> So are you able to display a portal within a portal? Or are you
>> using a GetNthRecord calc field in the Child records to show the
>> Grandchildren records within the Child portal? Or are you doing
>> something else magic??
>
>
> Derrick Fogle
> derrick at fogles.net
>
>
>
> _______________________________________________
> 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