Newbies chardin Posted November 11, 2010 Newbies Posted November 11, 2010 Which record becomes the current record after a 'Go to layout' script step? So far it seems to return to the last record I was working on, but I can't find a place that clearly confirms that. For background, what I'm doing: I'm trying to connect people to organizations through an 'ORG CONTACTS' link table. While on the organization layout, they click a button to add a contact person - copy [select; ORGANIZATION:Org Name] Go to Layout ["ORG CONTACTS"(ORG CONTACTS)] New Record/Request Go to Field [ORG CONTACTS: Org Name] Paste[select] Go to Layout["CONTACTS"(CONTACTS)] Enter Find Mode[Pause] Perform Find[] Copy[select; CONTACTS::Contact ID] Go to Layout ["ORG CONTACTS"(ORG CONTACTS)] Go to Field [ORG CONTACTS:: Contact ID] Paste [select] - can I safely assume to be returning to the same newly created record on my second Go to Layout["ORG CONTACTS"(ORG CONTACTS)]? Thanks!
bruceR Posted November 11, 2010 Posted November 11, 2010 Copy paste should be seriously avoided in scripting. Try something more like this: set variable[$orgname ; ORGANIZATION:Org Name] Go to Layout["CONTACTS"(CONTACTS)] Enter Find Mode[Pause] Perform Find[] set variable[$id ; CONTACTS::Contact ID]] Go to Layout ["ORG CONTACTS"(ORG CONTACTS)] New Record/Request Set Field [ORG CONTACTS::Contact ID; $id] Set Field [ORG CONTACTS::Org Name; $orgname] Commit Records
Newbies chardin Posted November 11, 2010 Author Newbies Posted November 11, 2010 Yeah, I also cringe at using copy and paste - but it doesn't seem like Filemaker7 _has_ set variable() My only other option (which I've used elsewhere) seems to be global table variables, which won't work unless they're displayed on the layout *wince* I'm teaching myself Filemaker, so I really appreciate advice!
bcooney Posted November 11, 2010 Posted November 11, 2010 (edited) Welcome Chardin to the forums. Your script needs help. How about taking apart this demo? It shows how to script the assignment of a Person to an Organization and an Organization to a Person using a join table PeoOrg. Notice the relationships are all done with IDs, not names! Yikes! Didn't think that you were really using FM7. Sorry, this uses $vars and Exit Script ( ). How about using global fields? That's FM7 friendly. You could also simply allow creation of related records in the relationship, and use value list popup menus in the join table portal. JoinDemo2.fp7.zip Edited November 11, 2010 by Guest
bruceR Posted November 11, 2010 Posted November 11, 2010 "My only other option (which I've used elsewhere) seems to be global table variables, which won't work unless they're displayed on the layout *wince*" There is no such thing as a global table variable. There are global fields; and the set field step does NOT require the fields to be on the layout.
comment Posted November 11, 2010 Posted November 11, 2010 My only other option (which I've used elsewhere) seems to be global table variables, which won't work unless they're displayed on the layout *wince* It WILL work if you use Set Field[]. Another option is to use a script parameter.
Recommended Posts
This topic is 5126 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