7 Replies Latest reply on Jun 3, 2014 11:21 AM by bruns

    Time Summary

    bruns

      Title

      Time Summary

      Post

           I have time_in, time_out, total time (calculation time_out - time_in).  This is all working

            

           I have a field s_time (summary field) outside portal to total all training time.  This is working however if I go and change time_in or time_out , total_time calculates correctly but s_time will not update unless I switch screen or tabs. 

            

           I put a script trigger on total_time to Refresh Window on modify, did not work, did not update

           I put a script trigger on time_out to Refresh Window on modify, did not work, did not even show field until I switched screen

            

           Any ideas

        • 1. Re: Time Summary
          philmodjunk

               Define a calculation field in the layout's table that uses the Sum function to compute the same portal total. This assumes that you are using an unfiltered portal as this calculation will ignore any filtering. It should update smoothly where a summary field needs scripted help to update. (I would guess that your script needs to commit records and then maybe refresh the window before you get the needed total.)

          • 2. Re: Time Summary
            bruns

                 That did it, thanks

            • 3. Re: Time Summary
              bruns

                   Is there a work around for the filter , I have added a filter to the portal which was needed, but now it does not update the s_time.

              • 4. Re: Time Summary
                philmodjunk

                     What is the filter expression?

                     Commit records
                     Refresh Window

                     Should cause the summary field to update.

                     If you put the summary field inside a one row portal that refers to the same related table and uses the same portal filter expression, the summary field will display a value based on the related records that pass the filter.

                     But many filter expressions can be replaced by a new relationship with additional match fields and this can often be a better option to use.

                • 5. Re: Time Summary
                  bruns

                       the portal filter is

                       (Employee_Course::fk_id_courses = Employee_Course::g_trainingFilter) or (IsEmpty(Employee_Course::g_trainingFilter))

                        

                       The script is

                       commit

                       Refresh window

                       I have the script set as script trigger on total time.  Not sure about that one

                  • 6. Re: Time Summary
                    philmodjunk

                         Going just by the name, total time is probably a summary or calculation field, a trigger on that field is very unlikely to be tripped. You need this trigger on a field inside the portal that you edit to produce a different total. OnObjectSave is a typical trigger to use unless the field is formatted as a pop up menu, check box or radio button field. In those cases, OnObjectModify can be a better option.

                         It's possible to replace this filter expression with match fields and calculation fields that produce the same result.

                    • 7. Re: Time Summary
                      bruns

                           Ok those script trigger are working fine, but

                            

                            one last thing, I have also added a little drop down filter on the outside of portal and it is working fine, when I select something it narrows the portal down to just that, however , the s_time field on the outside of the portal will not update.