November 11, 201015 yr Newbies 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!
November 11, 201015 yr 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
November 11, 201015 yr Author Newbies 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!
November 11, 201015 yr 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, 201015 yr by Guest
November 11, 201015 yr "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.
November 11, 201015 yr 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.
Create an account or sign in to comment