# Restrict answers to specific values

484
8
08-20-2018 11:53 PM
Highlighted
New Contributor III

Hello,

I am facing two requirements I don't get a grip on. The customer wants to restrict the answers to a question to very specific constraints and formats:

1. We need an (editable, integer) spinner that runs from 0 to 359 (circular angles). Spinning up from 359 starts with 0 again. Spinning down from 0 runs backwards beginning with 359.
2. We want the values for a decimal question to be negative at all times (values between 0.00 and -100.00 with two decimal places). The user shouldn't bother if she/he enters a positive or a negative value. Thus, positive entries should be converted to negative values on the fly.

Any idea how to accomplish these two requirements? If they cannot be fulfilled now, I would like to propose them as enhancements.

Thank you, best regards,

Jürgen

Tags (3)
8 Replies
Highlighted
Regular Contributor

Seems like you should be able to add an equation into the constraint column for Survey123 connect when creating the form.

First instance

constraint column entry would = (\${testing}>=0)and(\${testing}<360)

constraint message entry would = "Please enter a value of 0 to 359"

Second instance

constraint column entry would = (\${testing}<=0)and(\${testing}>-100)

constraint message entry would = "Please enter a value of 0 to -100"

This could also be accomplished by having a hidden question that would actually contain your answer and would be the one you would report within your export. This hidden question would have an if() statement; something like if(\${testing}>0,(\${testing*(-1)),\${testing}).

Mike

Highlighted
New Contributor III

Hi Mike,

Thank you very much for your reply. If I understand your answer correctly you are proposing to use constraints in both cases and a hidden field in the second case to convert all positive entries to a negative value.

Although I haven't fully understood the purpose of the hidden field and neither its potential, I think the customer requirements are rather focused on the behavior of the question types when entering values. They are looking for a kind of WYSIWYG behavior.

First instance

If you have an integer question with spinner appearance that displays the value 0 and you hit the minus button the displayed value changes to -1. We would like to restrict the displayable values to the range of 0 to 359. So, if the integer question displays the value 0 and you hit the minus button the displayed value changes to 359. (Technically, you would be able to hold the plus button down forever and the displayed values would always run from 0 to 359 and then to 0 again to 359 and so on.)

Second instance

Again, it is the display of the value that is in the focus. No matter if the user enters "12.34" or "-12.34", the question should automatically display a negative value -> "-12.34". (E. g., if you want a text string to be all capitals, you can use a mask like ">AAAA". With this mask, when the user types in a lowercase letter, the question automatically displays capitals.)

I hope these details help to better understand what my users are looking for.

ThankS once again, best regards,

Jürgen

Highlighted
Regular Contributor

Hello,

So the functionality that you are looking for would be a "custom" effort as the current state of the Survey123 application doesn't appear to allow this behavior.

The reason why I was suggesting a hidden; but if it needs to be visible you can always make it visible, field is that you can apply a calculation to the previous question using the if() function that would give you the "Always negative" number by evaluating the value of the previous question and applying one of two mathematical equations to transform the number entered by the user to return the negative value.

However, if it is an instance where the user must see a negative number within the same question, then I do not believe this functionality is available. Reason is that the Survey123 connect compiler will return an error due to a dependency cycle when applying a calculation on the same question.

As for the spinner only showing a certain range of values and exhibiting the reset once it crosses either 0 or 359 is also going to be a custom function I believe.

sorry I could not provide the exact functionality within the application you wanted.

Highlighted
New Contributor III

Thank you for your help nonetheless. Any chance to define these as enhancement requests?

Highlighted
Regular Contributor

You should be able to post them to the ArcGIS Ideas page while tagging the Survey123 team.

Here is a link to the webpage and you might want to complete a search prior to posting to prevent duplicate ideas from being submitted.

Highlighted
Esri Esteemed Contributor

Hi Jürgen,

For the first request, the appropriate ArcGIS Idea entry is Survey123: Feature Aspect .  Please take a look at Ismael's comment in that thread - there has been some work toward accomplishing that.

On the second one, it looks doable with an input mask of -00.00 for a text question (perhaps -00,00 for locales using a decimal comma, though you might have to do some additional work to covert into a number).

Highlighted
New Contributor III

Hi James,

Yes, the feature aspect idea seems to be exactly what we are looking for (apart from the wind direction labels, since we want to specify the position on a circle).

As for the second requirement, I am not totally convinced to use the masking. I find the behavior of masks confusing. My idea would be, instead of using a conventional constraint on a field (that is only validated when the data is submitted) to directly restrict the entry of data into a field. Let's call it "restricted spinner" appearance. E g. an integer that is constrained to values between 0 and 50. When these limits are reached the spinner buttons just stop adding (plus button at 50) or subtracting (minus button at 0). This would be a much more direct user experience.

Do you think this idea is fit for the ideas section?

Best regards,

Jürgen

Highlighted
Esri Esteemed Contributor

Hi Jürgen,

Yes, what you describe is something appropriate to post in the Ideas section.