6 Replies Latest reply on May 5, 2015 7:08 AM by philmodjunk

    tracking users

    bbell

      Title

      tracking users

      Post

      I want to track how long a user has been viewing a layout.  I am going to creat layouts that represent manufacturing processes.  I want the log table to be separate from the process table.  whin I try to creat the script and run it it loops creating endless records.

        • 1. Re: tracking users
          SteveMartino

          I guess the first step is to define 'viewing'. Is it simply a matter of how long a particular layout, or a particular record has been open?  Or is it a group of layouts/TO's tied to a record?  Or a session.  Posting your current script would also help.

          • 2. Re: tracking users
            bbell

            I have 4 tables.  One for user log in, one for user log out, one for layout in and layout out.  All have associated scripts to add data to them.  The Login User and Logout User Tables has Account Name, Date Time Stamp, and ID.  The layout_User_In and Layout_User_Out have Layout Name, Account Name, and Time Stamp.  I need to create a report that shows the User login time, the layouts visited and how long followed by log-out time.  Can you help?

            • 3. Re: tracking users
              philmodjunk

              Don't see why you need so many tables.

              One table with fields for:

              Account name, layout name, Timestamp on entry, Timestamp on exit

              Script triggers for OnLayoutEnter and OnLayoutExit should sufice to create a new record on entering a layout and updating the current record on exiting it.

              The trick is to avoid having your script trip it's own script trigger which is probably how your are getting endless records.

              One trick is to use a relationship to create the new log record without leaving the current layout.

              The other is to use a global variable combined with If steps that check that variable in your trigger performed scripts:

              If [ Not $$TriggersOff ]
                 Rest of trigger controlled script goes here
              End If

              Your script to create a new log record can then look like this:

              #This script trips its own trigger

              If [ Not $$TriggersOff ]
                 Set Variable [$$TriggersOff ; value: True ]
                 Go to Layout ["UserLog" (UserLog)]
                 New Record/Request
                 Set Field [ UserLog::LayoutName ; Get ( LayoutName )
                 #Other fields can auto enter account name and creation Timestamp.
                 Go to Layout [original layout]
                 Set Variable [$$TriggersOff ; value: False ]
              End If

              • 4. Re: tracking users
                bbell

                I know I have 4 tables but it is working. All I need to to is connect the information in a report.  Any suggestions?

                • 5. Re: tracking users
                  mananaja

                  I have no suggestion. I hope to learn more too. Help!

                  • 6. Re: tracking users
                    philmodjunk

                    Using a single table makes the reporting very simple. With multiple tables, you have to link the records in each table to each other which will be more more than setting up a single table for this purpose.