6 Replies Latest reply on Jun 21, 2011 2:51 PM by RonKanter

    Use Get(AccountName)



      Use Get(AccountName)


      I have a table consisting of two fields, Full Name and Account Name.  I basically use this table to create a value list.  In my form on another table I only display the Full Name.  The two table are setup in a relationship.

      When a user logs onto the system I get their account name and want to use that value to set the default value in a drop-down list field.  The issue is I want display the Full Name based not the account name.

      Can this be done?



        • 1. Re: Use Get(AccountName)

          Using the Account Name you can use a number of methods to find the associated Full Name and store that value in a variable. Then you can use this in an auto-enter calculation so that new records will auto-enter this full name to serve as the "default value" in this field.

          A simple script that can run each time the file opens to find the Full Name of the current user:

          Go To Layout ["Account table" (Account Table)]
          Enter Find Mode [] // clear the pause check box
          Set Field [Account Table::Account Name ; Get ( AccountName ) ]
          Set Error capture [on]
          Perform Find[]
          If [ Get ( FoundCount ) = 0 ]
             Show Custom Dialog ["Error, a record with account name: " & Get ( AccountName ) & " was not found in the account name table."]
             Set variable [$$FullName ; value: Account Table::Full Name ]
          End If

          In your field options for the field where you want the Full Name as the Default value, select the auto-Enter | Calculation option and enter:


          As it's sole calculated expression.

          • 2. Re: Use Get(AccountName)

            It sort of works.  The script leaves the account table open.  When I try to go back to the layout that shows the original table the system goes into an enless loop.

            • 3. Re: Use Get(AccountName)

              There is no loop in this script, so I don't know what is creating the appearance of an "endless loop" here. Just add a go to layout step to the end of this script to go to whatever layout you need to and it should work for you.

              • 4. Re: Use Get(AccountName)

                My problem might be that I am running the script when the layout is open.  So everytime the script run at the end it goes back to this layout and starts the process over. 

                • 5. Re: Use Get(AccountName)

                  That's exactly what is causing it.

                  Instead, open File Options and specify that this script be run when the file is opened. That will run it only once, each time that the file is opened by a user.

                  • 6. Re: Use Get(AccountName)


                    Thanks again for all your help.  Everything is working great now.