Select to view content in your preferred language

Select multiple assessment values

928
8
Jump to solution
02-07-2024 03:00 PM
alyssajhnsn
Occasional Contributor

I'm trying to develop an assessment, but I'm not the brightest bulb of the bunch. The way I have it written, it lists the score values I've tried to assign instead of adding them together (e.g., instead of adding 3 "1"s together, it lists them as "111" instead of "3"). Any help is appreciated.

alyssajhnsn_0-1707346521130.png

 

0 Kudos
1 Solution

Accepted Solutions
abureaux
MVP Frequent Contributor

EDIT: I made a few notes here as I was going through the XLSX (attached).

This is fine as-is because you are using count-selected() on its own. It's just the nature of count-selected() to give you the result you are looking for. But, if you combine this with other calculates you will likely run into issues:
abureaux_2-1707413637265.png

This one wont work because you wrapped the entire end result in int(). Essentially, you are converting your string of separate numbers (e.g., 111 vs 3) into an integer. If you want this to work, each individual item needs its own int() (e.g., int(${field1}) + int(${field2}):

abureaux_5-1707413869682.png

You use a lot of type hidden fields. This is not recommended:
abureaux_3-1707413732481.png

The better approach is to select the appropriate data type (e.g., Integer) and then make the appearance hidden:
abureaux_4-1707413796355.png

Because your IF statements use "null", you are adding stuff that shouldn't be added, meaning you may end up with this in some cases (NaN = Not a Number):
abureaux_0-1707413598042.png

Looking at your formula, it may make more sense to swap a few things up.For example, most of your "hidden" fields should b calculates.

I also noticed you were missing your constraints for the spinners. This is how they should appear:

abureaux_9-1707414668759.png

For future reference: calculates do not require a label, and notes do not require a name.

I have made some edits to the XLSX. I am not saying that it is perfect, but it should put you into the right direction (and all of your calculate fields at the end are working).

View solution in original post

0 Kudos
8 Replies
DougBrowning
MVP Esteemed Contributor

It does this since all fields are treated like strings inside the form so it is doing a concat.  In the bind::type column set it to int then the fields will act as int inside the form.  I thought integer in type worked fine now also but I guess not.

Hope that helps

0 Kudos
alyssajhnsn
Occasional Contributor

Thanks for your help. I've tried updated the bind column to int, but now the score is showing as blank instead of showing any values.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Is your score field an Integer type?  Did you also set that bind to int?  If you are still stuck then just post the form.

0 Kudos
abureaux
MVP Frequent Contributor

@DougBrowningis correct. This is definitely a case of text fields being used for math.

Here is a visual idea of that he is describing. Note the use of the bind::type column:

abureaux_0-1707408279738.png

Which results in my_field2 properly adding my_field (e.g., 32+5+7=44) rather than combining fields (e.g., 32+5+7=3257) like you are seeing:

abureaux_1-1707408386171.png

(note that this example is a very sub-optimal set-up for the purposes of an example. Typically, you wouldn't use a "text" field like this)

0 Kudos
alyssajhnsn
Occasional Contributor

I'm not a Survey123 expert by any means, so I may not have use the best development. I was basing it off this survey here: https://community.esri.com/t5/arcgis-survey123-questions/assigning-values-to-choices-for-select-mult...

I've tried update the bind type to int, but now the score is showing blank instead of showing any values.

0 Kudos
abureaux
MVP Frequent Contributor

EDIT: I made a few notes here as I was going through the XLSX (attached).

This is fine as-is because you are using count-selected() on its own. It's just the nature of count-selected() to give you the result you are looking for. But, if you combine this with other calculates you will likely run into issues:
abureaux_2-1707413637265.png

This one wont work because you wrapped the entire end result in int(). Essentially, you are converting your string of separate numbers (e.g., 111 vs 3) into an integer. If you want this to work, each individual item needs its own int() (e.g., int(${field1}) + int(${field2}):

abureaux_5-1707413869682.png

You use a lot of type hidden fields. This is not recommended:
abureaux_3-1707413732481.png

The better approach is to select the appropriate data type (e.g., Integer) and then make the appearance hidden:
abureaux_4-1707413796355.png

Because your IF statements use "null", you are adding stuff that shouldn't be added, meaning you may end up with this in some cases (NaN = Not a Number):
abureaux_0-1707413598042.png

Looking at your formula, it may make more sense to swap a few things up.For example, most of your "hidden" fields should b calculates.

I also noticed you were missing your constraints for the spinners. This is how they should appear:

abureaux_9-1707414668759.png

For future reference: calculates do not require a label, and notes do not require a name.

I have made some edits to the XLSX. I am not saying that it is perfect, but it should put you into the right direction (and all of your calculate fields at the end are working).

0 Kudos
alyssajhnsn
Occasional Contributor

Thank you SO much for your help. You're a life saver. I got it working with your help, although for some calculations I had to add in an int specification in the calculation.

0 Kudos
alyssajhnsn
Occasional Contributor

Thank you, I will take a look at this and probably pester you if I have more questions. Thank you so much. We are in the process of validating this assessment (the first time an assessment on this topic has been validated), and it may end up being adopted by other communities for use as well. So it's important I get the form in the best shape.

0 Kudos