5 Replies Latest reply on Apr 25, 2011 1:25 PM by philmodjunk

    how to calculate time in a portal

    gasolineman

      Title

      how to calculate time in a portal

      Post

      so i have a record for today, inside that record i have a portal with rows that include a related table and a field for Time In that is inserted into the field when a action button is clicked in the row.  i have a second button that is clicked that inserts a Time Out.  both of these work fine.  i have a third calculation field that is supposed to subtract the two fields to give me a total time spent doing a particular task.  in a non portal environment it works just fine, but in the portal the calculation field wont work.  

      the portal data comes from the a Data table and the record comes from a Records table.  the two tables are related by the date.

      the calculation is simply the Time Out - Time In resulting in a number.  the field is blank in the portal.  it usually does the calculation and works fine when not in the portal.

      Screen_shot_2011-04-25_at_2.16.31_PM.png

        • 1. Re: how to calculate time in a portal
          philmodjunk

          I have no idea what you are describing here in terms of tables and relationships. Your screen shot shows one portal and at least 4 fields. Elapsed time calculations using fields that are all defined in the same table such as these time in and time out fields should be, will evaluate the same whether or not they are part of a portal.

          I'd also use time stamp fields instead of time if there is any chance that midnight might fall between time in and time out.

          Using time stamp fields,

          TimeOut - TimeIn

          will compute the elapsed time in seconds. You can return the computed value as type time and display it with time formatting to get HH::MM:SS or you can return a number to compute the elapsed time as a decimal number.

          Thus, ( TimeOut - TimeIn ) / 3600 could compute the elapsed time in hours.

          These expressions also work for Time fields as long as you don't cross the midnight boundary between in and out times.

          • 2. Re: how to calculate time in a portal
            gasolineman

            well i appreciate your efforts here  but that does not work  sorry that you cant understand what im describing.  

            what im saying is... the Time in is inserted when i click the aux in button.  the Time Out is inserted when i click the aux out...  the field just to the right of the aux out is the calculation field that is supposed to calculate the difference and is simply time out - time in.  it does not give any result in that field at all.  it is empty.

            • 3. Re: how to calculate time in a portal
              philmodjunk

              What I described is exactly how I log time in my Projects database in a portal when I log my time in and out on a database project. It definitely works exactly as I have described it.

              Are all three fields defined in the same table?

              Is that table the table referred to in Show Records from of Portal set up for your portal?

              If no, to either question, please describe exactly how you have defined these fields and the relationships that link any tables that are involved.

              • 4. Re: how to calculate time in a portal
                gasolineman

                i really cant describe this any more simply.  

                of course all three fields are defined in the same database.  why would a calculation field not show when the others do?  that doesnt make any sense. 

                i really dont understand your question.  the time in and time out and entered as shown in the screen grab.  the calculatuon field that subtracts on field from the other simply does not enter any data into that field.  these same fields work in the same way in a different database when they are not in a portal.  in this database, in a portal... the calcualtion field does not work.  simple.

                • 5. Re: how to calculate time in a portal
                  philmodjunk

                  Simple, but you must be missing something in how you set this up or it would work. I'm trying to help you figure out what might be different this time around.

                  Download this demo file and compare it to yours:  http://www.4shared.com/file/r0x-6Bg2/ElapsedTimeInPortal.html