You are viewing limited content. For full access, please sign in.

Question

Question

Forms Calculations not working every time

asked on October 30, 2018 Show version history

I have a Sum field for a table that is zeroed out when Billable Items Labor Checkbox is unchecked. 

These Table Totals also sum to a Grand Total Field.

Here is the calculation I use inside each total field:

=IF(Billable_Items.Labor, SUM(Labor.Amount), "0")

This is the calculations on the Grand Total:

=SUM(Total_Equipment,Total_Labor,Total_Materials,Total_Other)

 

When the form is saved down into Laserfiche.  The Grand Total is reflecting the sum of all even if the Labor box is unchecked and zero.

You can see the grand total does not reflect the show table totals for Material and Equipment.

Checking Labor, the missing amount that is not being correctly zeroed is there in the metadata.

I wanted to see why this is happening only some times but also if there is a better solution for making sure Table Totals are truly zeroed out upon saving to the Repository when Billable Items value is unchecked.

 

0 0

Replies

replied on October 31, 2018

Here is my solution copied from the other (pretty busy) post:

 

I have a workaround for those of us on 10.2.1.

I'll put the solution up first and then give some supporting info after.

$(document).ready(function(){
  
  setTimeout(function(){
  $('.totalSeed input').change();
  }, 1000);  

});  

 

For any total field, I assigned the class 'totalSeed' to the field that is being calculated. Not the total field, but the field where the total is being calculated from. After 1000 milliseconds .change() is called on that class. It triggers change for any field you put the class into.

I noticed that the total would recalculate if the input of the field changed. I could NOT do this using javascript .change() outside of the setTimeout. I tried .change() on the total field but that didn't work either. 

For some reason it needs a delay. I brought the number of milliseconds down to 1 and it worked. So, 1000 (1 second) is being extremely cautious. When I saw that it worked with 1 millisecond I thought the setTimeout might be unnecessary and I just needed to nest it in a function and then call the function. Nope. 

Maybe someone can figure out if this is a viable workaround to an extremely inconvenient bug.

Thanks,

Chris 

1 0
replied on November 1, 2018

That's very useful thank you.

I actually as a workaround before you posted this; built a small workflow that double checks the total Sums that are Checked only to the Grand total, if they match fine.

No Match I rewrite the Grand Total with the correct value and amend the document with a note.

1 0
replied on November 2, 2018

^great idea!

0 0
replied on October 31, 2018 Show version history

@████████

I believe this is a known bug.

First try removing the read only property in the 'Layout' tab. Assign the readonly with javascript.

         $(this).find('.[class]').val([variable]).trigger('change');
         $(this).find('.[class]').attr('readonly', true);

If that doesn't do the trick, check out this post. There are several solutions in there, but the above is the least labor intensive.

Good luck!

0 0
replied on October 31, 2018

That post looks like there were fixes after upgrading to 10.3.x  I am currently running Professional Version 10.3.1.635.  

Was this bug under the list of known bugs for the most recent version?

I don't run the fields as read-only.  They are hidden on the submission forms and show and editable on the last approval form.  But never read-only.

0 0
replied on October 31, 2018

Yeah, the bugs were still there. Not fixed. We installed 10.3 in our dev environment and the issues still exist.

To help with your problem, have you confirmed that you are saving the data in Field Rules?

 

That could be another thing obstructing your totals. After that you may want to try my solution on the other post. Good luck, I hope you find an easy answer.

0 0
replied on October 31, 2018

Yes.  Form 1 (Submission Form) and Form 2 (First Approval Form) both have their fields saving data.

When at Form 3 (Final Approval Form) it is shown.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.