Formatting an Calculated field

My app has Tasks (among other things). I want to display the percentage of Tasks that were completed before their due date,–thus completed on-time.

On the DB side, I have a yes/no for completed on-time. So for my display I tried the following calculation

Which is simply the number of tasks complete AND completed on-time divided by the number of tasks completed:


The math works correctly, but my results end up as 72.343583650937563… I cannot “:format as:” a percentage to cap the number of decimals.

Any thoughts?

Can you add a formatted as after the last :count?


If I do that, is just adds the formatting to the denominator… it does not hold for the calculation

Two steps then? Shove the calculated value into a Custom State (anywhere… these are the equivalent of local variables as I’m sure you know) and then in next step format that previously computed value. It shouldn’t impact performance in any meaningful way.

I’ve run into more than a few evaluation order things like this in Bubble and, while annoying (boy parentheses would be helpful, right?), it’s easily solved by just doing another workflow step. In most cases, this type of workaround seems to have no more performance impact than a JavaScript where you have a more or less redundant line of code like:

var tempvalue = a*b;
return tempvalue/c;

… if you get my drift.

Yeah, I do; however, I wasn’t using a workflow for this. I guess I could make one to trigger on page load…

The problem with states, though, is that I also have the same equation on a per-user basis. The users are displayed in a Repeating Group, and that number of users may vary across sub-apps.

So, I guess I could attribute a performance field to the “User” Type, calculate that field on page load?.. I’ll try it and report back.

OK, I found the resolution, and I’ll post it here in case anyone has similar problems.

So, here was my goal: To display On-Time Task Completion as a Organization, and then broken out by users.

In order to get the Overall Completion Percentage I created a custom state for the group container of all this text. I created a workflow that triggered on page load to do a search on “Tasks” that had been completed on-time, counted them and divided by Tasks that had been completed and counted them.

I then had to create a text with dynamic input, showing the Group’s state:formatted as: a percent

For the User Individual Scores it was the same logic, however, I had to create a Field for the Data Type “User”. On the same page load trigger, I ran a workflow updating the the List of Users from my repeating group, and updated their Performance Field with the new values. Then in the repeating group, I simply displayed “This Cell’s User’s Performance” field, formatted as a percentage.

I could not use state on the individuals because state would apply to the whole repeating group, not each user within that group. I had to use a data field to essentially serve the same function as a state.

I hope that helps someone in the future. Case closed.


This topic was automatically closed after 70 days. New replies are no longer allowed.