Select to view content in your preferred language

Adding integers for a select One from list type question giving error

965
5
Jump to solution
07-11-2023 04:06 AM
RachelS
Occasional Contributor III

Hi,

I have 6 select from one list type question where the possible answer is +1 or -1. I then want to add the answers from these. But rather than adding the integers in a calculation it just adds a 1 into the sum box. e.g. -1111.

If I try setting the bindType field to Int then it says Error converting XLS form.

 

I'd appreciate any help.

 

Thanks

Rachel

0 Kudos
1 Solution

Accepted Solutions
MobiusSnake
MVP Regular Contributor

From what I can see, it looks like issues will occur if any of the questions aren't completed, but as long as all six questions are completed, the value comes out okay.  One option would be to change your calculation to this:

number(${stonefly1})+number(${mayfly1})+number(${caddisfly1})+number(${snail1})+number(${leech1})+number(${waterlouse1})

This will result in the calculation failing (and showing nothing) until all six questions are completed, since the number() function will fail on missing values.

If these questions are all mandatory that should work, if they're optional then I think you'll need to include some if() functions.

View solution in original post

5 Replies
MobiusSnake
MVP Regular Contributor

Your calculate line is missing a few dollar signs.  You've got them for the first couple variables but they're missing after that.  I just tried bringing your XLSX into S123 Connect, set the binding on that last question to Integer and inserted the dollar signs and it looks all good.

0 Kudos
RachelS
Occasional Contributor III

Ah thanks @MobiusSnake , I'd updated the dollar signs but didn't update the xls sheet.

I've attached the xls with the updates you mentioned but the calculation still doesn't work for me.

I'm on version 3.18.123.

Here's what I get below.

RachelScott_0-1689079158337.png

 

 

0 Kudos
MobiusSnake
MVP Regular Contributor

From what I can see, it looks like issues will occur if any of the questions aren't completed, but as long as all six questions are completed, the value comes out okay.  One option would be to change your calculation to this:

number(${stonefly1})+number(${mayfly1})+number(${caddisfly1})+number(${snail1})+number(${leech1})+number(${waterlouse1})

This will result in the calculation failing (and showing nothing) until all six questions are completed, since the number() function will fail on missing values.

If these questions are all mandatory that should work, if they're optional then I think you'll need to include some if() functions.

RachelS
Occasional Contributor III

Hi @MobiusSnake ,

Thanks for that, I'm just going to force the user to complete all the questions.

Regards

Rachel

0 Kudos
PanGIS
by
Regular Contributor

Hi @RachelS 

I noticed the missing dollars and I added myself.

the calculation works for me, I just added the dollars.

( I have forgotten to upgrade 😅 and I am using connect 3.16.110)

PanGIS_0-1689085197266.png

 

0 Kudos