Go to a related record in an existing window -
07-13-2005
, 08:05 PM
Hi all,
I'm building a database where data entry is performed in a separate window
for each table.
If a the window for a related table is already open, I want to re-use that
that window to display the related record, retaining any re-sizing and
re-positioning.
I'm going to a related record from a portal row. I tried the following
script:
If[ PatternCount (WindowNames; "Assign Assets To Location")>0]
Select Window ["Assign Assets To Location"]
Go to Related Record [From table: "Locations"; Using Layout: "Locations"
(Locations)]
Exit Script
End If
Go to Related Record [From table: "Locations"; Using Layout: "Locations"
(Locations); New Window]
Adjust Window [Resize to Fit]
This works to open a new window with the related record. If the window is
already open, it activates the window, but merely displays the same record
as before the script is run.
Is there a way to do this without a procedural script (cut/paste/find)?
Using the relationship is much cleaner.
I could get the size and position of the target window, close and re-open
it, but will Filemaker remember which portal row the button click was from?
Yes, that works:
If [ PatternCount (WindowNames; "Assign Assets To Location")>0 ]
Select Window [ Name: "Assign Assets To Location" ]
Set Field [ Globals::gWindowHeight; Get ( WindowHeight ) ]
Set Field [ Globals::gWindowWidth; Get ( WindowWidth ) ]
Set Field [ Globals::gWindowHPos; Get ( WindowLeft ) ]
Set Field [ Globals::gWindowVPos; Get ( WindowTop ) ]
Close Window [ Name: "Assign Assets To Location" ]
Go to Related Record [ From table: "Locations"; Using layout:
"Locations" (Locations) ] [ New window ]
Exit Script
End If
Go to Related Record [From table: "Locations"; Using Layout: "Locations"
(Locations); New Window]
Adjust Window [Resize to Fit]
Better than a procedural script, but I'd still prefer the first option if
there's a way.
Thanks for any suggestions,
-jb |