Forum Discussion

DawnDawn's avatar
DawnDawn
Qrew Trainee
9 years ago

How can I create a formula to count the number of times a field has been modified?

I have a multiple choice field, [ISR Calling Status], that logs the entries. I want to create a formula field that counts the number of times that field has been modified (timestamped). Is there a formula that I can write for this? Can't seem to find any suggestions.

Thanks much!

  • Try this

    var text value = [My text field which is logging the changes];

    Count(
    Part($value,1,"]"),
    Part($value,2,"]"),
    Part($value,3,"]"),
    Part($value,4,"]"),
    Part($value,5,"]"),
    Part($value,6,"]"),
    Part($value,7,"]"),
    Part($value,8,"]"),
    Part($value,9,"]"),
    Part($value,10,"]"),
    Part($value,11,"]"),
    Part($value,12,"]"),
    Part($value,13,"]"),
    Part($value,14,"]"),
    Part($value,15,"]"),
    Part($value,16,"]"),
    Part($value,17,"]"),
    Part($value,18,"]"),
    Part($value,19,"]"),
    Part($value,20,"]")
    )
    • LauraThacker's avatar
      LauraThacker
      Qrew Captain
      This was hugely helpful; my only comment (for others who see this) is that if I leave in the first Part($value,1,"]"), I get an extra-count; so I commented that line out to get an accurate count.  I also switched the ] to a [ because I found that in some cases the logging field had copied the original Note entry again; but without the first/opening [, so by looking for that I got a more accurate count.  This might just happen to apply in my case.
    • ChrisDobberfuhl's avatar
      ChrisDobberfuhl
      Qrew Member
      Is it possible to modify this formula to count the number of times a date / time field is updated?  I have a database of logins to a number of hardware devices and I keep track of the date and time they are logged into.

      ------------------------------
      Chris Dobberfuhl
      ------------------------------
  • hmmm, tried that and it's returning a Syntax error (Possible culprits are a mismatched set of parentheses, missing quotes, or an extra bracket.) I can't see anything missing off-hand.
  • Mark...you ARE THE MAN! Worked like a charm! Thanks so much!!!
  • Mark, is there a way to do this for a file field? I would like to count the number of revisions that have been uploaded to a file field, in order to use that revision count number for another formula. 
    • PAULPAUL's avatar
      PAULPAUL
      Qrew Trainee
      Figured out my own answer.  What I did was create a new text field title [PDF Revision History] which is logged.  I then created a form rule that read as follows:

      When the record is saved and [File] has been changed
      Change [PDF Revision History] to the value in [File].

      Note: Thanks again Mark! I found this formula from a question you answered previously in:
      https://community.quickbase.com/quickbase/topics/how-to-track-revisions-to-a-pdf-file

      I then created a new field with the forumula you had listed above and modified it:

      Count(
      Part($value,2,"]"),
      Part($value,3,"]"),
      Part($value,4,"]"),
      Part($value,5,"]"),
      ""

      This counts the number of times the [PDF Revision History] field has been modified which directly correlates to my [File] field.
      • FrancescoSpiga1's avatar
        FrancescoSpiga1
        Qrew Cadet
        What if the Attachments are saved in a separate table?
        How do you get the count? (excluding the summary fields here, as the file will be replaced and not added in the child table)

        ------------------------------
        Francesco Spiga
        ------------------------------