Link to home
Start Free TrialLog in
Avatar of rmartes
rmartes

asked on

FileMaker: Perform find on unrelated table/field

Hi Experts,

I have a table containing global fields called GLOBAL_FIELDS with one field: G_SEARCH_SSN. I have a layout called SEARCH based on the GLOBAL_FIELDS table with that one field on it. This is the default layout opened with the file is opened.

I have another table called EMPLOYEES with its own layout.

Both tables are unrelated.

I'm trying to PERFORM A FIND (EMPLOYEES:SSN=G_SEARCH_SSN) from the SEARCH layout on a field from the EMPLOYEES table. If found, GO TO LAYOUT (EMPLOYEE) then GO TO RECORD. If not found, CUSTOM DIALOG "employee not found":

IF (CODE(GET(TRIGGERKEYSTROKE) = 10)) Then //enter key
PERFORM FIND (EMPLOYEES:SSN=G_SEARCH_SSN)
IF (GET(FOUNDCOUNT) = 0) THEN
SHOW CUSTOM DIALOG <-- "no employee found"
ELSE
GO TO LAYOUT (EMPLOYEE)
GO TO RECORD <-- I want to go to the one in the found set
END IF
END IF

Open in new window


When I try this, I get an error: "this operation cannot be completed because the target is not part of a related table"

How would I accomplish this???

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Will Loving
Will Loving
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rmartes
rmartes

ASKER

Thanks guys for your responses:

Will Loving, the reason I don't have the script go into the Employees layout and straight into Find Mode is because it loads at least one record and then goes into Find Mode. I don't want that. It causes the layout to load up slow, especially when your loading a ton of records from an external source. So, I'm trying to isolate the search upon load.

historychef, the value list won't work as I'm connected to an external source that has a ton of records (ton of SSNs). I need them to physically enter search criteria. Also, I'm using a third party plugin from MonkeyBread Software (http://www.mbsplugins.eu/component_SQL.shtml) to run inserts and stored procedures on temp tables I have created in my external source upon searching. So, I need to isolate the search and the global variables. I can't relate them. MonkeyBread Software works really well.

Here is what I ended up doing:

// OnLayoutKeyStroke for my Search Layout
If (code(get(triggerkeystroke)) = 10) //enter key
commit records [no dialog] //saves global value
freeze window
go to layout (employees)
set field (employees::ssn;g_search_ssn)
perform find[]
if (get(foundcount)) = 0)
go to layout (original layout) //search layout
custom dialog // no records found
else
// perform MonkeyBread scripts
go to record // found
end if
end if

Open in new window


I'm accepting both your answers as you guys were the only ones that replied with helpful thoughts.
Avatar of rmartes

ASKER

Very helpful!
Well, as I noted in the other question, if you went to a different layout not based on Employees, ran a Custom Dialog to get the SSN (use a Global field somewhere for the Input field), went into Find Mode, THEN switched layouts to Employees you could then run the Find without having to load Employees into Browse.