1 of 1 people found this helpful
You should learn how to use external data sources.
It allows you to share tables between files so you dont have to go through all those steps to get two files to work together.
Another possibility is to merge the two files into one.
finds are context specific ( what is the active window and what Table Occurence is the layout in the window bound to when find is performed?)
With that external data source, you can add an occurrence of that table in your PR file and then a layout in your PR file based on it. Your script could then go to that layout to find records, but there are other ways to access data in that table that do not use a find that you might also consider.
Maybe I am missing something. I have already created an external data source via the Manage function for the IM database. This allows me to type in a part number in the PR file and FM then grabs all the associated data to the part number (description, cost, etc.) and populate the portal in the PR file. My question arises from the fact that on occasion the IM records are lacking all the related data and I wanted to give the users a chance to update those records as they discover the missing data.
Write the search script (Enter Find Mode, etc.) in the Master Item file. Specify to the calling Perform Script step (in the PR file) the target file as well as which script. (At the top of the Perform Script dialog is a menu to select the target file.)
Use script parameters and the Exit Script step to pass information to the target script and back to the caller.
For example, the caller might want to search for part number 5678 in the master file. The Perform Script step might be:
Perform Script [ "Search for Part" from file: "Master Item" ; Parameter: 5678 ]
and the Search for Part script would include:
Set Variable [ $partNumber ; Get (ScriptParameter) ]
Search for $partNumber and then do something with the results -- update the matching record, call another script, return the number in inventory to the caller, etc.
To answer your original question. A find script needs to be in the master file. From the Pr file you call the find script in the master file. Use a script parameter to pass the find value from the PR file to the master file. In the master file use Get(scriptparameter) to retrieve the find value. Btw, you also do not need to do a show all before doing a find. Also as mentioned previously, there probably are better ways to accomplish what you want.
Create a second table occurrence of the relevant IM table and use a global field (populated with the part number) as the left side of the relationship.
There are other ways to accomplish the same thing: switch to a layout with the IM table and search it is one.