Page 1 of 1

Maths total - Adding up ListcomboBox

PostPosted: Thu May 20, 2004 1:19 am
by stresskit
Hello

I have a few questions for you experts out there...

1. Could someone plz explain to a novice like me how to add up a number of scores from a ComboBox- so far I have been using Math "[ComboBox1]+[ComboBox2]+[ComboBox3]+[ComboBox4]+[ComboBox5]+[ComboBox6]+[ComboBox7]+[ComboBox8]+[ComboBox9]+[ComboBox10]+[ComboBox11]+[ComboBox12]""2" "results"

Very tedious...must be a better way...

2. If I am using a ComboBox -itemnumber- how do I set it that it reverse scores?
so on a Lickert Scale 1- Most like me and 5- Least like me BUT a few questions involves a reversal of the scoring....so far I have just changed the order in the comboBox but my users don't like this...so how do I change it in the coding?

Thanks

StressKit

Maths total

PostPosted: Thu May 20, 2004 5:56 am
by Gaev
StressKit:

Could someone plz explain to a novice like me how to add up a number of scores from a ComboBox- so far I have been using Math "[ComboBox1]+[ComboBox2]+[ComboBox3]+[ComboBox4]+[ComboBox5]+[ComboBox6]+[ComboBox7]+[ComboBox8]+[ComboBox9]+[ComboBox10]+[ComboBox11]+[ComboBox12]""2" "results"

This works with ComboBox variables or any other Arrayed variables ...

SetVar "[Results]" "0"
Loop "1" "12" "[ThisIteration]

    Math "[Results]+[ComboBox[ThisIteration]]]" "2" "[Results]"

EndLoop

... this simple loop can also be enhanced to work when the entries to be summed are not contiguous.

2. If I am using a ComboBox -itemnumber- how do I set it that it reverse scores?
so on a Lickert Scale 1- Most like me and 5- Least like me BUT a few questions involves a reversal of the scoring....so far I have just changed the order in the comboBox but my users don't like this...so how do I change it in the coding?


I am assuming that "when user selects entry with the text "1- Most like me", you want the value 5 assigned to it, and 4 for the next one and 3 for the one after ...

a) For the ComboBox option labelled "Variable Contains", choose "Item Number"
b) In the section "Selection Changed" ...

SetVar "[ChoiceScoreXX]" "6-[ComboBoxXX]"

... where XX is 1, 2, 3 etc. depending on the ComboBox ; you may want to make sure that initial values are set (and not the default null value associated with an unselected entry) ; also, if you want to combine this with the previous function, just change the "Variable To Store Selected Item" to something else (like [SelectedComboBoxEntryXX] ) ; then ...

SetVar "[ComboBoxXX]" "6-[SelectedComboBoxEntryXX]"


... hope this works for you.

Maths total

PostPosted: Thu May 20, 2004 6:28 am
by Sam Cox
Relocated somewhat off-topic answer about summing values in a single listbox to here.

(Edited by Sam Cox at 2:16 pm on May 20, 2004)