Simple Calculation

Tagged: 

Viewing 2 reply threads
  • Author
    Posts
  • December 28, 2019 at 6:16 PM #39005

    tambor
    Participant

    Hi,
    On every record of my document, I need a calculation field that lets me know how much I’ve spent so far.
    I know that Tap Forms does that for us at the bottom on my document in the popup but for some reason that’s not good for me.

    My documents fields are:
    – date
    – subject (text field)
    – price (number field)
    – calculation field

    My question: what is the correct formula to enter in “calculation field” for my purpose?

    Thanks.

    December 28, 2019 at 6:59 PM #39008

    Sam Moffatt
    Participant

    I don’t think you can do this with a simple calculation field because the calculation field can really only work with the data that is in the record. A running total, as an abstraction, would require you to know an original “opening balance” for the record to start from (or assume zero, but when?).

    I think I have an example elsewhere of using a form script to calculate a bank balance though it was doing subtraction rather than addition. This was implemented as a form script to recalculate value based on a search, you could reformat it to work with your own form.

    The one challenge with this would be is that the ordering the script field works on is based on the ordering in Tap Forms. You would need to make sure that your record ordering in Tap Forms is set correctly when running the script to recalculate the values.

    In theory you could do a field script to calculate this as well however you’d have to be careful because field scripts aren’t run when a record is created so it is possible that it could become inconsistent.

    December 29, 2019 at 10:46 AM #39015

    tambor
    Participant

    Hi Sam,
    Thank you very much for your very useful explanation and for the link to your script which should be used with all the necessary precautions/caveats you mention.

    I think for my purpose I’d better keep using my form with an (unfortunately) very very long list of Saved Searches.

Viewing 2 reply threads

You must be logged in to reply to this topic.