Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Internal label does not appear in sql database

Thanks for your response we have tried this several ways.  Still using the example of Gender we where able to create a variable Gendertext that shows the Male or Female text when chosen.  However we had further  added a hidden internal label that respondents don't see with number codes that we need to access for each list member .  

ex.   1-Male (5679)
        2- Female  (5680)

Do you know how we might access the hidden internal label (5679) in the export? It does show up on the online admin data page so we do know the question is working correctly.
asked Sep 30, 2014 by cunnic Bronze (1,440 points)

1 Answer

+1 vote
From the previous example, you saved the GenderText variable as such ...
[%SetValue(GenderText,Label(Q1))%]

This would simply save "Male" or "Female" to the SQL database based on Q1 being the gender question.

Given you are now changing the text you wish to save to the SQL database, try this ...
[%Begin Unverified Perl 

 if(VALUE("Q1")==1) 
  {  
   SETVALUE("GenderText",'Male (5679)');  
  }

 if(VALUE("Q1")==2) 
  {  
   SETVALUE("GenderText",'Female (5680)');  
  }

End Unverified%]

This will now write "Male (5679)" or "Female (5680)" to the SQL database.
answered Sep 30, 2014 by Paul Moon Platinum (67,780 points)
You can also create variables using free format hidden questions as opposed to using the SetValue function.

And if you are wanting to display lists with different text, you can use a handy function called "MIrror".
Thanks so much, Paul.  This solved the problem.
Great, glad your problem is solved.
...