Constrain for current single answer from previous integer question

Hello !

I am having a problem like this: I want to put a constraint between an integer input and a choice in multiple choice question.

q1. How much do you spend on food for a month? _________

q2. Please select the range ?

  1. Less than 750 USD
  2. Between 1000 USD - 1200 USD
  3. More than 1800 USD
    I want to put a constraint that warn/avoid the surveyors in case they input 1800 USD and select 1 or 2. Is there anyway to do that.

I use the xls syntax “(q2=‘1’ and ${q1}<10 ) or (q2=‘2’ and ${q1}>=10 and q2=2 and ${q1}<=20) or ( q2=‘3’ and ${q1}>20)” BUT I could not get success so could you please help me to make right syntax…

Thank you very much.

Dev Maharjan

Hi Dev,
My first thought is why you want them to enter the information twice. You can easily use the integer value in the first question in a subsequent ‘calculate’ question to provide an output that would be the same as a multiple choice question, but without requiring the interviewer/respondent entering anything in a second question. For example, if you had the following choices for question 2 (note I have changed your income ranges because your example has categories with gaps between them):

Label Name

  1. Less than 750 USD 1
  2. 750 USD - 1800 USD 2
  3. More than 1800 USD 3
    Then instead of making q2 a MCQ, make it a calculate with the following syntax:

if(${q1}<750,‘1’,if(${q1}>1800,‘3’,‘2’)

This will produce the categories which you can then refer to in future questions (and will show up in your database). If you havev more than three categories, just use more nested ‘if’ statements.

If you have a good reason to get them to answer (almost) the same question twice, the problem with your syntax is that you need to use the period (fullstop) to refer to the current question when writing constraints - you could also ${q2} but ‘q2’ as you use here won’t refer anywhere - all references to questions need to wrap the question name in ${}. So the correct syntax would be something like:

(.=‘1’ and ${q1}<10 ) or (.=‘2’ and ${q1}>=10 and ${q1}<=20) or ( .=‘3’ and ${q1}>20)

Cheers,

Matthew

···

On Wednesday, 12 July 2017 02:34:21 UTC+10, Dev Chandra Maharjan wrote:

Hello !

I am having a problem like this: I want to put a constraint between an integer input and a choice in multiple choice question.

q1. How much do you spend on food for a month? _________

q2. Please select the range ?

  1. Less than 750 USD
  2. Between 1000 USD - 1200 USD
  3. More than 1800 USD
    I want to put a constraint that warn/avoid the surveyors in case they input 1800 USD and select 1 or 2. Is there anyway to do that.

I use the xls syntax “(q2=‘1’ and ${q1}<10 ) or (q2=‘2’ and ${q1}>=10 and q2=2 and ${q1}<=20) or ( q2=‘3’ and ${q1}>20)” BUT I could not get success so could you please help me to make right syntax…

Thank you very much.

Dev Maharjan

Dear Matthew,

Many Many THANK YOU…It’s GREAT !!! it is working very well.

You are right the first method can be used but i need both that can verify to both questions…

···

i was mistake in my syntax …

Cheers

Dev Maharjan

On Wednesday, July 12, 2017 at 7:59:28 AM UTC+5:45, matt...@gmail.com wrote:

  1. Less than 750 USD 1
  2. 750 USD - 1800 USD 2
  3. More than 1800 USD 3
    Then instead of making q2 a MCQ, make it a calculate with the following syntax:

Hello !

I am having a problem like this: I want to put a constraint between an integer input and a choice in multiple choice question.

q1. How much do you spend on food for a month? _________

q2. Please select the range ?

  1. Less than 750 USD
  2. Between 1000 USD - 1200 USD
  3. More than 1800 USD
    I want to put a constraint that warn/avoid the surveyors in case they input 1800 USD and select 1 or 2. Is there anyway to do that.

I use the xls syntax “(q2=‘1’ and ${q1}<10 ) or (q2=‘2’ and ${q1}>=10 and q2=2 and ${q1}<=20) or ( q2=‘3’ and ${q1}>20)” BUT I could not get success so could you please help me to make right syntax…

Thank you very much.

Dev Maharjan

Hi Dev,
My first thought is why you want them to enter the information twice. You can easily use the integer value in the first question in a subsequent ‘calculate’ question to provide an output that would be the same as a multiple choice question, but without requiring the interviewer/respondent entering anything in a second question. For example, if you had the following choices for question 2 (note I have changed your income ranges because your example has categories with gaps between them):

Label Name
if(${q1}<750,‘1’,if(${q1}>1800,‘3’,‘2’)

This will produce the categories which you can then refer to in future questions (and will show up in your database). If you havev more than three categories, just use more nested ‘if’ statements.

If you have a good reason to get them to answer (almost) the same question twice, the problem with your syntax is that you need to use the period (fullstop) to refer to the current question when writing constraints - you could also ${q2} but ‘q2’ as you use here won’t refer anywhere - all references to questions need to wrap the question name in ${}. So the correct syntax would be something like:

(.=‘1’ and ${q1}<10 ) or (.=‘2’ and ${q1}>=10 and ${q1}<=20) or ( .=‘3’ and ${q1}>20)

Cheers,

Matthew

On Wednesday, 12 July 2017 02:34:21 UTC+10, Dev Chandra Maharjan wrote: