Newbies stuartp Posted October 30, 2008 Newbies Share Posted October 30, 2008 Hi I'm trying to join two tables, hopefully via a drop-down menu. As an example the table structure can be reduced down to the following tableA tableA_ID: Number (a PK field) tableB_ID: Number (a FK field) tableB tableB_ID: Number (a PK field) name: String (some text) There is a relationship between them defined as tableA::tableB_ID = tableB::tableB_ID I have a layout for tableA and I would like to put a popup or drop-down menu in it that displays all the values from tableB::name, and when something is selected from this menu, it sets the tableA::tableB_ID to the corresponding tableB::tableB_ID value. Currently I can achieve this via a button that performs a script that is as follows: New Window [ Name: "TABLE B WINDOW"; Height: 500; Width: 500; Top: 50; Left: 50 ] Select Window [ Name: "TABLE B WINDOW"; Current file ] Go to Layout [ “TABLE B LIST” (TableB) ] // a layout that shows a list view of all the values of tableB::name Pause/Resume Script [ Indefinitely ] // So the user can select a value from this list Set Variable [ $tabB_ID; Value:tableB::tableB_ID ] Close Window [ Current Window ] Go to Layout [ original layout ] Set Field [ tableA::tableB_ID; $tabB_ID ] but this is a cludge - it looks unintuitive and awkward, and the user is required to click the continue button to resume the script. Any better solutions out there? cheers Stuart Link to comment Share on other sites More sharing options...
aldipalo Posted October 30, 2008 Share Posted October 30, 2008 Welcome to the forum. Generally, it's easier to understand your request when you are more specific about your tables and fields. CustomerID JobID ClientID ContactID Customer Layout, etc. Currently, there is no way in Native FM to trigger a script upon entering or leaving a field. It sounds as though you need a plugIn like Event Script (Free) or Script Fire (Shareware). If this is what you are asking? Link to comment Share on other sites More sharing options...
comment Posted October 30, 2008 Share Posted October 30, 2008 I'm not sure I understand your question either. Selecting a parent for a child from a drop-down menu is rather trivial (see for example: http://fmforums.com/forum/showtopic.php?tid/198949/post/307130/#307130 ), so if you need something more complex, please clarify. Link to comment Share on other sites More sharing options...
Newbies stuartp Posted November 3, 2008 Author Newbies Share Posted November 3, 2008 Thanks for the reference. Even though it worked quite well I found the first example rather complicated and fiddly - not the sort of thing you want to do if you're planning to do a lot of work with relationships. The other examples seem to work a little cleaner - they are essentially hiding a field that is set to a drop-down list behind a field that is an edit field. Both display artifacts (switch field display when the user clicks on them) but will work for what I need, so thanks again. Its interesting to see the effort required to get this to work - is FileMaker likely to address? Link to comment Share on other sites More sharing options...
comment Posted November 3, 2008 Share Posted November 3, 2008 You can also use a pop-up instead of a drop-down. This will hide the ID completely from the user, so there's no need to cover it with a related field. Again, this is suitable only if the 'second field' is unique. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 5792 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now