Is it possible to create new variables?

More
2 years 8 months ago #118295 by rcwd
rcwd created the topic: Is it possible to create new variables?
I need to group some results in end message.
Is it possible to create variables?

What i want to achieve is in like this:

{
MYNEWVAR_1 = countif( 'AAA', D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12)
MYNEWVAR_2 = countif( 'BBB', D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12)
MYNEWVAR_3 = countif( 'CCC', D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12)

if(MYNEWVAR_1 > (MYNEWVAR_2 + MYNEWVAR_3), 'hello world!', 'bye bye' )
}

Please Log in to join the conversation.

More
2 years 8 months ago #118299 by Ben_V
Ben_V replied the topic: Is it possible to create new variables?
1 variable => 1 equation type question

As answered in your other similar post , you have to previously create equations to sum your responses.
After ou will be able to display a message a message using EM or Javascript; I don't know how it is possible to sort (up or down) numeric results using EM except doing substractions (it's ok for 2 or 3 numbers) and that's why I've indicated you a js method (the only way i know to sort more numbers).

Re-using your example you need:
a) 3 questions to set your variables
MYNEWVAR_1 => {countif( 'AAA', D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12)}
MYNEWVAR_2 = {countif( 'BBB', D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12)}
MYNEWVAR_3 = {countif( 'CCC', D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12)}

b) 1 equation to compare the results and display your messages.
{if(MYNEWVAR_1 > (MYNEWVAR_2 + MYNEWVAR_3), 'hello world!', 'bye bye' )}

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!