This a draft I resurrected after 5 years. Yes, it is late. However, this is still relevant. Today we going to look at how to achieve this in both On-Premises and Cloud.
A few years back a friend of mine asked me this question, “How can I check whether a value entered in a webform is an integer or not?”
Back then, the only options were.
- Create a validation rule and let the user know that they can only enter integers.
- Use a business rule and round the values to make it an integer.
Both options have their challenges. 1st option will let the user know that the entered data is wrong. However, they can ignore that message and keep going.
2nd option is not going to give the user an indication and will change the data that they entered.
On-Premises, we are still stuck with these options, so let’s look at how to set up the validation rule.
Validation rule – On-Premises
The idea is to round the entered value then check whether the entered value and the rounded number are the same – for an integer, both the numbers are going to be the same.
I’m using the “Revenue Plan – Products” webform in Vision application. We are going to check whether Units is an integer. I’m doing this only for “Jan.” You can expand it for all months if needed.
What I did was to add a formula column, and the formula used is TRUNC([A(A)],0). Since column A is saying add all descendants of Yeartotal inclusive, that makes it an expanding column. A(A) is representing Jan, and A (B) represents “Feb” so on and so forth. Here A(A) is telling the formula to pick the first column from the expanded column of A.
Once the formula column is added (and hidden), create a validation rule on column A as shown below.
The validation rule is checking whether the member is Units and Jan, and if the current cell value is not equal to Column B, then paint it red.
Let’s enter a non-integer number and see what happens.
Yayy, it works 🙂
To achieve this, I had to remove the business rule “Revenue Plan – Products” rule from running on save.
This is the second option that we talked about, using @ROUND to make Units an integer.
We are going to look at how to do this with groovy in Free form Planning in the next part.