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
- Customer Resources
- 64.8K Get Help
- 434 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives