Have an idea?

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

How shall I extract date variable form database to be screening condition for the following questions?

I hope to take Q1_Day data,the conditions of screening

Begin Unverified Perl
if (GETValue("Q1_day") == 15)
if (GETVALUE("Q1_day") == 16)
End Unverified

<input type="text" id="datePicker" placeholder="dd/mm/yyyy">
<input name="Q1_Unix" id="Q1_Unix" type="hidden" value="">
<input name="Q1_Year" id="Q1_Year" type="hidden" value="">
<input name="Q1_Month" id="Q1_Month" type="hidden" value="">
<input name="Q1_Day" id="Q1_Day" type="hidden" value="">
<input name="Q1_ReadableString" id="Q1_ReadableString" type="hidden" value="">

    onClose: function(){
        var date = $('#datePicker').datepicker('getDate');
        // Unix
        // Y, M, D
        $('#Q1_Month').val(date.getMonth() + 1); // months are zero-based
        // Readable string
        $('#Q1_ReadableString').val($.datepicker.formatDate('MM d, yy', date));
related to an answer for: Date picker in free format question
asked Jan 17 by anonymous

1 Answer

0 votes
When using unverified Perl, Sawtooth Script functions must be written in all caps.  Additionally, names of questions and lists must be surrounded by quotation marks.

Begin Unverified Perl
if (GETVALUE("Q1_day") == 15)
if (GETVALUE("Q1_day") == 16)
End Unverified
answered Jan 17 by Zachary Platinum Sawtooth Software, Inc. (70,525 points)
How do I get the date from the system data, I do not get this data Q1_day,how to get?
Thank you!
You also need to use "Q1_Day" instead of "Q1_day" - the name needs to be exactly the name of the variable you use in your free format question.
Get it,Thanks!