Get ( Accountname) will return the account name used to open the current file. In many cases, both files will be opened with the same account name and in those cases, this will return what you want.
If the other file was opened with a different account name, then you'll have to capture that account name in a field somewhere. The other file, for example could have a script that stores the result of get ( accountname ) in a field. Use file options to set this script to run when the 2nd file opens, and you'll succeed in capturing that data.
Thanks for the reply
I don't think I was clear on what I'm trying to accomplish...
(File1) in a script, display an error message if user's favorite food is pizza
(File2)One record for each user. Username field which matches Get(AccountName) and a field with the user's favorite food
I want the script in File1 to figure out the user's favorite food by matching Get(accountName) with the username field in File2 to figure out what that is.
Account Name and User Name are two different things.
Account Name is set in Accounts and Privleges and may be different for each file.
User name is a preference setting for the filemaker app.
Get ( AccountName ) will return the name of the account name used to open the current file.
Get ( UserName ) will return the User Name from preferences and this will give you the same result for every file a given user opens on their computer.
Right. I want to use Get(AccountName) since that will always be the active directory username.
Define an unstored calculation field (result is Text) in File1 =
and set up a relationship matching the calculation field to the AccountName field in File2.
Then you can refer to the related data in a calculation, e.g. =
Case ( File2:: FavoriteFood = "pizza" ; "error message" )
Yes!! Thank you!