2 Replies Latest reply on May 11, 2015 5:42 PM by missij99360262

    Not sure why this isn't calculating..

    missij99360262

      Three columns...

      In time

      Out Time

      Total Time (calculate based on in and out entered)

       

                 <field name="hours1" w="18.182mm" h="10.04mm" access="readOnly">

                        <ui>

                           <numericEdit>

                              <border presence="hidden">

                                 <?templateDesigner StyleID aped0?></border>

                              <margin/>

                           </numericEdit>

                        </ui>

                        <font typeface="Myriad Pro"/>

                        <margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/>

                        <para vAlign="middle" hAlign="center"/>

                        <border>

                           <edge/>

                           <corner thickness="0.1778mm"/>

                        </border>

                        <calculate>

                           <script>if( HasValue(spec1b) &amp; HasValue(spec1a) ) then

      // compute time difference in minutes

      var TimeDiff = (Time2Num(spec1b.formattedValue, "h:MM A") - Time2Num(spec1a.formattedValue, "h:MM A")) / (1000 * 60)

      // truncate to hours

      var HourDiff = Floor(TimeDiff / 60)

      // get minutes less than 60

      var MinDiff = Mod(TimeDiff, 60)

      // build fomatted dispaly string

      Concat( Format("Z9", HourDiff), ":", Format("99",MinDiff) )

      else

      // if any values missing null the output

      null

      endif

      </script>

                        </calculate>

                     </field>