Skip to main content
Question

How to prompt the user if the sum of specified fields is not equal to 100% ?

  • Sep 30, 2017 2:17 AM UTC
  • 0 replies
  • 165 views

We want to include some automatic checking of date entry errors, and in one of our apps we need to have the sum of several fields that the user enters total to 100%.  What are some efficient ways to prompt the user for corrections when the total is incorrect?  I guess we could use "Dynamic Rules" to throw up a custom error message under those conditions, but we would rather require the user to get that total correct before they save that record.

I feel certain we are not the first or only customer to need this feature...
This topic has been closed for replies.

  • Qrew Corporal
  • Sep 30, 2017 2:44 AM UTC
Just ask the user for two out of three inputs and calculate the third as demonstrated in this demo:

Meatloaf ~ Two Out Of Three Ain't Bad ~ Add New Record

https://haversineconsulting.quickbase.com/db/bm5h58ry3

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=603


  • Author
  • Qrew Member
  • Sep 30, 2017 9:18 PM UTC
Hot patootie � bless my soul" this might work for us.  Did you build this with simple calculated fields, or within Dynamic Rules? 

(I have a limited view of this demo app and don't see any way to grab the administrator view.)

  • Qrew Corporal
  • Sep 30, 2017 9:32 PM UTC
>don't see any way to grab the administrator view

I have hundreds of public demos available and it would be impossible to make any of them available to everyone on the internet as an administrator. A lot of my answers and demos are crafted in a manner that addresses the fact that they are public and I don't want to have to maintain them constantly so sometimes I answer a slightly different questions than what is asked. But rest assured every single well formed question in this forum has an answer with a positive outcome. The hardest part for me in answering a question is figuring out what the heck the person is asking (not the case here) and of course coming up with a good attention grabbing gimmick that will induce readers to reflect on my ever so subtle subliminal messages.

>Did you build this with simple calculated fields, or within Dynamic Rules?  

No. I use the standard IOL technique documented in the pastie which uses a code page containing script. I would also add that I just put some random priority logic in the script not necessary the logic you would require. It would be a simple matter to implement other logic, limit the precision of percentages or prevent negative number etc. 

With the passage of time the QuickBase Singularity has arrived. We are converged and everything is now possible with QuickBase (using script).

One solution is to have the last field be a formula field equal to 1 - the sum of the other fields. Then it will always total to 100%. That sound like your best solution.

The other method is to have two messages controlled by an IF statement. There can be a red message saying the total and saying it does not add to 100, and a green message saying Totaks OK.

Let me know if you need help with the color formula.

  • Qrew Corporal
  • Oct 1, 2017 8:55 AM UTC
How about just converting QuickBase's inputs to sliders (ie <input type=range>):



A Plate Full Of Sliders ~ Add New Record

https://haversineconsulting.quickbase.com/db/bm5k6564x?a=nwr

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=606



Notes:

(1) I only implemented this feature for new records. Simple to extend for edit records.

(2) The code could be improved but I was short time and needed to make a quick road trip to White Castle.

  • Author
  • Qrew Member
  • Oct 2, 2017 5:35 PM UTC
Your point is well-taken, Dan.  But remember that part of the Quick Base pitch is that teams can quickly build most of their applications "without writing code".  If I start presenting script macros as the solution to routine problems, that "no coding required" value disappears.  My current clients have no scripting skills and want to manage their applications without paying for those skills.

  • Qrew Corporal
  • Oct 3, 2017 5:04 AM UTC
But the "no code" / "low code" thing is just a marketing pitch. The first thing you have to do after swallowing that ipill s to write QuickBase formula (which is coding) which can be extremely lengthy and complicate.

  • Author
  • Qrew Member
  • Oct 3, 2017 5:29 PM UTC
Well many users do find the click-and-drag Quick Base formulas more intuitive than scripting.  And "do it yourself" is more than a marketing pitch -- its a real value than even teams with smaller budgets can appreciate.

But I do think your quote is the most important thing I have ever read on these community pages:

"With the passage of time the QuickBase Singularity has arrived. We are converged and everything is now possible with QuickBase (using script).