3 Replies Latest reply on Jan 23, 2013 9:08 AM by philmodjunk

    Creating Forms / Merge Fields

    Annette

      Title

      Creating Forms / Merge Fields

      Post

           Hi,

           I am creating some forms and would like some help with merge fields. 

           I have a table called Users where it stores the name, login name, address, etc of users of the database. 

           What I would like to do is on the layout I'm creating, insert the name and address of the person that is logged in printing the form.  Is this possible?  If so, how do I go about doing this? 

           Sorry if it's a really stupid question. 

           Thanks in advance for your help!

        • 1. Re: Creating Forms / Merge Fields
          philmodjunk

               It's certainly possible to use the current Account name to look up a record in Users that has that account name, but what you do next depends on the design of your database.

               You'll need to describe your data model.

               On what table is your layout based?

               Have you defined a relationship between that table and Users?

               If so, what match fields are used in that relationship?

               Do you need that "inserted" data to be temporarily part of that layout's record or found set of records or should it be permanently recorded in fields of that layout's table (or a related table)?

                

          • 2. Re: Creating Forms / Merge Fields
            Annette

                 The Layout is based on my Clients table because it's printing letters/forms pulling mostly client information. 

                 I have other occurances of my Users table in my relationships which pulls particular people (if that makes sense) i.e. there is an occurance of the Users table which is referenced to find only those people that are doctors, another to find those only nurses etc. 

                 These tables are related by Client::ClientID - Users::FKClientID

                 The inserted data can be temporary I believe because while I created a table called forms (which is also related to clients by the client ID) I don't care if it actually saves this information, it is not necessary on the database itself as users print the forms, its merely a simple and fast way to fill in the form given that 99% of the inforamtion is coming from different areas of the database. 

                 Does that make sense or have I raised a whole bunch of other questions/concerns?

            • 3. Re: Creating Forms / Merge Fields
              philmodjunk

                   Get ( AccountName ) will return the "log in name" of the current user.

                   A script can perform a search for the record with that account name in Users and then copy the data into global fields or global variables that can then be placed on your layout to show the name and address of that user.

                   Or you can define an unstored calculation with Get ( AccountName ) in your layout's table that matches to an occurrence of Users by account name.

                   Then you can simply place the name and address fields from that occurrence of users on your layout and they will display the current user's name and address.