"how to select by script the current row in a portal" - you can use the function Get ( ActivePortalRowNumber ) and capture that in a variable.
You can then navigate to that row again using the script step Go to Portal Row
Set the Portal2 to be filtered by a global field. Click the row in Portal1 and capture or calculate what the new filter criterion should be. Set that gloabl field to be that value.
I put a trigger on portal 1: on object enter => set variable[$objectNoSelected; value:get(activeportalnumber)
on the portal 2 filter I put; Object::ObjectNo=$ObjectNoSelected
it doesn't work, the portal 2 doesn't display the related row.
I wouldn't use a trigger here.
Set a button action to whatever field you want clickable in "Portal 1"
Then for that button setup your script...
Set the button t "Perform Script"
In your script setup all your actions for the filter. (i.e. set variable)
Can you provide a sample of the solution so we can see exactly what it is you are trying to do? We may have a much easier method for you than what we are working with now.
You should not filtering Portal 2 by 'Row Number', you should be filtering it by the value of the field that you picked up from the particular row in Portal 1 that you clicked on.
Here's how I set this up when I need this type of layout:
I define a button placed in the portal row of Portal 1 or I group all the fields in Portal 1 and define it as a button.
The button runs a script with this pattern to it:
Set Variable [$$FilterVariable ; Portal1TableOccurrence::FilterField ]
Refresh Window [Flush Cached Join Results]
The second line of the script forces the filter on portal 2 to update using the new value assigned to $$FilterVariable--which should be part of the filter expression for Portal 2.
I also usually set up a conditional format on all the fields in Portal 1 with an expresiion like this:
Portal1TableOccurrence::FileterField = $$FilterVariable
And select a light pastel fill color for the fields. That trick leaves the clicked field "highlighted" as a visual cue showing which portal row set the filter in Portal 2.
ok thanks, it works
the problem now is when i do Refresh Window [Flush Cached Join Results] all the page is refreshed (blink) and it's not beautiful. is there another way?
Yes, you can put the value in a global field defined in the parent table. (The table listed in "show records from" in Layout Setup...) Then define a relationship that includes this field in the relationship to the detail table:
Parent::ParentID = DetailTable::ParentID AND
Parent::gGlobalFilter = DetailTable::FilterField
This doesn't require a refresh window step to update the portal.
my problem is that the parent and the detail tables are the same.
in my case (the parent and the detail tables are the same) i have to use 2 portals ?
Not at all. You just need to use an additional table occurrence to the same table in your "self join" relationship.
Click on the table occurrence box in Manage | Database | Relationships to select it, then click the button with two green plus signs at the bottom left of the window to make a new table occurrence with the same data source table as the one selected. Now link it in the relationship like you would any other table occurrence. Base your layout on one Table Occurrence, base the portal on the other.
If "Table Occurrence" is a new term, you might want to read this thread, to learn more about how they are used in FileMaker databases:
that's what I did before, but still doesn't work.
Exactly what relationships do you have setup?
I have a main grid (portal) based on the Object table.
I want to whenver the user click on a row the layout will show him the detail of the selected row.
I created another instance of the same table (my table name = Object)
the link is :
Objectno = Selectedobjectmaingrid
main portal: table object
detail fields: table object2
in the mainGrid, when I select a row I run the scipt that copy the object:objectno in the object:Selectedobjectmaingrid field