Form error checking - adding up to 100%
I was asked to create a survey where various locations would be asked the total parking area and then percentages of the area dedicated to particular usage (i.e. tractor trailer parking, truck parking, customer, etc.) I can set up the field for this easily enough but I am running into an issue of making sure the numbers add up to 100%.
Any thoughts on how to accomplish this?
Best Answer
-
Can't you just ask them to enter the actual number for each of these and then calculate the percentage? You also have to anticipate that each location has a varied number of spaces.
Say, 25 total spaces
- 4 for tractor trailer
- 3 for truck
- 17 customer
- 1 handicapped
Then, what you are really checking is the value of each component against a total.
Since you want to use survey -- you would use a form right? You can't use a form to do collect and check for accurate entry on the fly. But you could write a form that collects initial survey and the email of the person completing it. Then, if a person enters values that don't sum to the total, send an update request.
This technique would require a helper to check that the categories sum to the Total Spaces. You may also want to report back the percentages on each type. In this case, the helper returns 0 so I know the sum is correct -- the constituent pieces add up to 100%
If a non zero is in the helper, then I generate an update request.
Answers
-
Can't you just ask them to enter the actual number for each of these and then calculate the percentage? You also have to anticipate that each location has a varied number of spaces.
Say, 25 total spaces
- 4 for tractor trailer
- 3 for truck
- 17 customer
- 1 handicapped
Then, what you are really checking is the value of each component against a total.
Since you want to use survey -- you would use a form right? You can't use a form to do collect and check for accurate entry on the fly. But you could write a form that collects initial survey and the email of the person completing it. Then, if a person enters values that don't sum to the total, send an update request.
This technique would require a helper to check that the categories sum to the Total Spaces. You may also want to report back the percentages on each type. In this case, the helper returns 0 so I know the sum is correct -- the constituent pieces add up to 100%
If a non zero is in the helper, then I generate an update request.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 63.9K Get Help
- 410 Global Discussions
- 220 Industry Talk
- 458 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 136 Just for fun
- 57 Community Job Board
- 459 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 298 Events
- 37 Webinars
- 7.3K Forum Archives