Set up Logic Condition based on Day of week selected


Hello – I want to set up a question using logic that will appear in the survey only when the end user selects a specific day (IE: when you select a day of the month that is a monday you will see a question with monday specific info)


Q2.Date requested is equal to Mo


Is this a capability?  thx in advance!!

Jim W (Moderator) answered
    carl 24 Rep.

    thanks – this is great.  Now for the BIG question… How do add this code and ultimately run the script?  🙂

    carl answered

      It depends on how your survey is structured. 

      Our usual method is to create an ADMIN ONLY page and then place the script and the admin only question on that page. After this page runs, the variable from the script will be available for any logic test.

      I would recommend that you create a prototype survey and use it as testing site for your questions and the script.  It might take several attempts, but once you have a structure that works you can recreate it in your actual survey.

      I am assuming that this is your first exposure to custom scripting.  If you are unfamiliar with programming it is a little daunting at first, but once you get it to work there is an enormous feeling of satisfaction once you get it to work. And then you start looking for the next opportunity to use your new skills. 

      BTW – there is some helpful documentation available on the SurveyGizmo site –

      Jim W (Moderator) answered

        You will have to use custom scripting for this.  For the following example, the pop-up calendar question that collects the date information has an ID of 11.  I have created an ADMINISTRATIVE question that will receive the day – it has an ID of 54.

        This is the script:

        1   %%xdate = sgapiStrtotime(sgapiGetValue(11));
        2   %%xdate = sgapiDate(“l”,%%xdate);
        3   sgapiSetValue(54, %%xdate);

        Line 1  – creates a variable (xdate) that is equivalent to the value that was entered into question ID 11 (sgapiGetValue).  The sgiapiStrtotime function converts the answer from a string into a date/time value.

        Line 2 – the sgapiDate function formats the date/time value into the day of the week (that is what the lower-case L defines – see

        Line 3 – the sgapiSetValue function places the variable into the ADMINISTRATIVE question ID 54 as the answer. 

        The line numbers are included for reference only, do not use them in your actual script.

        After this script has run you can then setup any logic you need on question ID 54 (or whatever ID number you have in your survey).

        Good luck!

        Jim W (Moderator) answered
          carl 24 Rep.

          Question Type  = Date  … respondent uses the pop-up calendar to select.  

          carl commented
            • we have a different schedule for each day.. I would like to show the next question based on the day selection from the pop up calendar…. does that make sense? 🙂


            It could be possible, but in order to answer your question we need to know how the respondent is selecting the day?  What kind of question type are you using to collect this information?

            Jim Wetherill answered


              Question stats

              • Active
              • Views5197 times
              • Answers5 answers
              • Followers1 follower