Quantcast
Channel: Adobe Community : Popular Discussions - LiveCycle Forms
Viewing all articles
Browse latest Browse all 61369

FormCalc

$
0
0

Hi!

 

I've been trying to add time fields using Formcalc with no success. I was wondering if someone could help me... This is getting really frustrating.

 

After a lot of trial and error I ended up with this piece of code:

 

    if (tPausa ne null and tPausa > 0) then

        totalLinhaRelatorio.formattedValue = Num2Time(tOut - tIn - tPausa - 158400000, "HH:MM")

    else

        totalLinhaRelatorio.formattedValue = Num2Time(tOut - tIn - 79200000, "HH:MM")

    endif

 

It basicaly calculates time spent on a task, considering start and end times and some time off, if there is any.

I have no idea why I have to subtract 158400000 OR 79200000 from the result to get the correct time. I only know it works.

 

Now, as this is a dynamic table, I must add the results to a variable to calculate the final total.

 

So I tried this:

 

if (tOut ne null and tOut > 0) then

    if (tPausa ne null and tPausa > 0) then

        totalLinhaRelatorio.formattedValue = Num2Time(tOut - tIn - tPausa - 158400000, "HH:MM")

        finalTotal = finalTotal + tOut - tIn

        form1.RATForm.parteInferior.totalGeral.formattedValue = Num2Time(finalTotal - 79200000, "HH:MM")

        totalLinhaRelatorio.formattedValue = Num2Time(tOut - tIn - 79200000, "HH:MM")

    else

        totalLinhaRelatorio.formattedValue = Num2Time(tOut - tIn - 79200000, "HH:MM")

        finalTotal = finalTotal + tOut - tIn

        form1.RATForm.parteInferior.totalGeral.formattedValue = Num2Time(finalTotal - 79200000, "HH:MM")

        totalLinhaRelatorio.formattedValue = Num2Time(tOut - tIn - 79200000, "HH:MM")

    endif

endif

 

Now this one doesn't work. It returns the correct value on the very first entry. Then all results for totalGeral are absolutely nonsense and doesn't seem to follow any pattern, so I'm  clueless.

 

Please, any ideas?

 

Thank you!!

 

Marcos


Viewing all articles
Browse latest Browse all 61369

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>