0

Filter not working for Formula

I've added a field to a table view. It simply counts the number of attachments for each record:

count(files(this))

Next, I add a filter to that column:

=0

I still see all records, regardless of their value. I thought, perhaps, somehow the column value type was being changed to a string, so I tested with ="0", but that didn't work either. Any suggestions on how to filter a formula field?

5 replies

null
    • Sean
    • 4 yrs ago
    • Reported - view

    Yeah, I get the same result and it doesn't make sense. The filter works in a View layout element which makes me wonder if it not working in the Table view is a bug. I created another Formula field and assigned numbers to it based on the contents of another field and was able to successfully filter on that Formula field.

    • Kevin
    • 4 yrs ago
    • Reported - view

    Thanks for verifying Sean. I too was able to filter a formula field that grabs its value from another number field. I tried force coercing the results of count via the number function, but that didn't work. I also added the formula as a new field in my table, but that didn't work either. I've sent an email to support@

    • Sean
    • 4 yrs ago
    • Reported - view

    Kevin, no problem. One option would be to create a Number field and use a Button or the Console to assign the values to the Number field. Here's the code I used...

     

    for i in select YourTable do
    i.(Attachments := count(files(this)))
    end

     

    "Attachments" is the Number field. It filtered correctly when I did this.

    • Kevin
    • 4 yrs ago
    • Reported - view

    Good suggestion and it worked well. I've also added a trigger to that field to keep it up to date

    • Kevin
    • 4 yrs ago
    • Reported - view

    The trigger doesn't appear to work. Oh well. I'll just make a global function and run it when needed

Content aside

  • 4 yrs agoLast active
  • 5Replies
  • 1077Views