More likely you are missing some detail in how you've constructed the relationships or layout. I'd also double check the values in each match field to make sure they have the values you expect.
"in the related fields from ... TableA only show the first matched value"
That's a puzzling description. Since your layout is based on TableA, why put fields from TableA in the portal? (They should all show the same value for every row in your portal.)
Thanks Phil for your reply.
In my querry, I forgot one more related table in between A and B: The relationship is like this
TableA -> Table E->TableB -> TableC <- TableD
So when I create portal based on Table C in layout of Table A and in the portal include filed from TableC, Table B and Table E, what happens is that for each record of TableA, I get a list of related record from TableC in the portal. However, the fields form the related records from TableB and TableE do not show correctly. For all the instances of records from TableC, the fields from only the first matching record from Table B and TableE are shown.
I have checked the related values and they are correct.
That clears things up and then I find I was "missing something" also. :smileywink:
The solution is to create additional table occurrences of TableB and TableE.
Add these to your graph, linking them to TableC.
You get this result: TableA --<TableE--<TableB--<TableC>--TableB 2>--TableE 2.
Add fields from TableB 2 and TableE 2 instead of TableE and TableB and they will display the correct values.
Why this is needed is the key question:
When you add fields from TableE and TableB, Filemaker traces through the relationships from TableA to TableE for the TableE fields and from TableA to TableE for the TableE fields. TableC has no affect on which records "match". By adding additional Table Occurrences "to the right" of TableC, and using fields from these Table Occurrences, the correct value matching takes place.
Your solution works like a charm.