Newbies sesh Posted July 9, 2008 Newbies Posted July 9, 2008 Hi All, I'm new to using FileMaker and am having an issue with a script I'm trying to write. Basically I've created a many to many relationship using an intermediary table because I need to store some information on the link. The association is between "Shops" and "Parks", with things like the distance between the two stored within the intermediary table. I was hoping to be able to add a button on the "Shops" page that said something like "Associate with Park". When the button is clicked the "Shop ID" is copied, and the user is taken to a new layout when the "Shop ID" is pasted into the foreign key field there. For some reason this doesn't seem to work, as when I create a new record on the intermediary table the contents of the copy is lost. (I think this is what's happening) Here is the script in pseudo-code: Copy [shop::Shop ID] Go To Layout [shop - Park Association] New Record/Request Paste [shop ID] Go To Field [Park ID] // so the user can now select the park Using FM7 on OSX. Any advice would be much appreciated. Cheers, Brenton
David Jondreau Posted July 9, 2008 Posted July 9, 2008 Copy and paste aren't the best tools to use. I'd recommend using global fields with Set Field[]s instead. You shouldn't be relying on Filemaker's Clipboard if you can help it. The issue may be with how you're using those functions, so simply adopting that good filemaker practice may solve your issue.
Vaughan Posted July 9, 2008 Posted July 9, 2008 The Copy and Paste script steps only work when the fields are on the current layout when they are called. Make sure the ShopID field is on the Shop - Park Association layout.
Newbies sesh Posted July 9, 2008 Author Newbies Posted July 9, 2008 OK, so I've got it working by creating a new table "Temporary" with the global field "Shop ID". I just set that field, then set the Shop ID on the other layout with that value. Is this the best/most correct way of doing this?
Vaughan Posted July 9, 2008 Posted July 9, 2008 The global field could have been in any table, but that's good. OTOH, if you'd have been using FMP 8.5 or later you could have used a variable to hold the value and done without the global completely. IMHO it's worth the upgrade to 8.5 (or 9.0) just for variables.
Newbies sesh Posted July 9, 2008 Author Newbies Posted July 9, 2008 I have to admit that I completely agree with you - this sort of application without being able to use something as simple as variables in scripts is a bit silly. Unfortunately the version of FileMaker being used isn't up to me :-(.
comment Posted July 9, 2008 Posted July 9, 2008 Actually, you could use the script parameter for this.
David Jondreau Posted July 9, 2008 Posted July 9, 2008 Actually, you could use the script parameter for this. Most elegant solution!
Recommended Posts
This topic is 6320 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