Thanks!
Thanks!
Assessment placeholders
When using assessments the following placeholders are available:
{PERC}: It displays the score of the current group. It can be used only in the message field of the assessment rule!
{TOTAL}: It displays the total score. Only available at assessment message
{ASSESSMENT_CURRENT_TOTAL}: This placeholder can be used within a survey to display the current total score.
<script>
$(document).ready(function() {
$('button#movenextbtn').hide();
});
</script>
<!-- Create a div within the question to wrap the table that we use to display the links/survey data -->
<div id="survey-table"> </div>
<script>
//define the survey server address below
var surveyServer = "http:<YOUR_SERVER_ADDRESS> [attachment=11214]Dashboard_Example.zip[/attachment] [attachment=11214]Dashboard_Example.zip[/attachment]/index.php/";
//grab the survey names, survey completion status, and survey numbers from LS
var surveyNames = "{list(that.surveyStatus.question)}";
var surveyAnsArr = new Array();
//we iterate through the listed surveys to gather their responses from the surveyStatus subquestions(the surveys)
//and store them in an array
if(!({count(that.surveyStatus.valueNAOK)}==0)){
surveyAnsArr = "{list(that.surveyStatus)}".split(",");
};
//get the qids for each surveyStatus subquestion(survey)
var surveyQidArr = "{that.surveyStatus.qid}".split(",");
//Survey qid's for subquestions aren't all that easy to tease out, so we get the QID here, and add the LS 'X' delimeter to it for future use
var surveyQid = "X" + surveyQidArr[0];
//Then we get the FULL subquestion id (the qid + the subquestion id)
var surveySGQAs = "{list(that.surveyStatus.sgqa)}".split(",");
//Then we get the survey names that we grabbed above from the surveyStatus.question for use in the table we'll create later
var namesArr = surveyNames.split(",");
var numberArr = new Array();
//have to break out the survey number from the QID....
for(i=0;i<surveySGQAs.length;i++){
sgqa = surveySGQAs[i];
//useing the qid, we tease out what the subquestion id is. Since the survey id is used as the subquestion id, we now have that for use later...
numberArr.push(sgqa.substring(sgqa.lastIndexOf(surveyQid)+surveyQid.length));
};
var lastCompleted = false;
var startNew = true;
var status = "";
$(document).ready(function() {
//this section creates a table with names and links in a way that LS just can't provide easily. THis way we can control the look/feel a little better.
var table = $("#survey-table");
addHtml = "<table><tr><th>Name</th><th>Status</th></tr>";
//create the table and relevant content using the variables above
//We use the names array we created above to create each row of the table that will display the survey name, the survey link, and the status for the participant of that survey
for(i=0;i<namesArr.length;i++){
addHtml += "<tr>";
//if there are no answers available, LS returns nothing, so answer array should be 0 length
addHtml += '<td>'+namesArr[i]+'</td>';
//I go through a series of if statements to determine what to included in the next cell of the table
//I apologize in advance for any and all coding faux pax
//So, if this is the first survey OR (I know it is AND, but this is the logic I think) the last survey wasn't complete. The status of the survey is
//do the one before this before continueing (dummy).
if(!startNew && lastCompleted){
status = "Pending completion of survey above.";
};
//If the answer array has a ZERO index, then NONE of the surveys have been completed by the respondent, So we change the flag to true for 'lastCompleted'
if(surveyAnsArr.length == 0){
lastCompleted=true;
};
//So, let's say that the respondent has answered 2 out of 4 surveys we want them to do.
//IF the number of answers available is GREATER than the survey number we're on, THEN
//we know that we have the answer to this question, and we can store it in the status variable
//which gets printed out in the table. The status is either "start" as a link to the survey, the
//date that the survey was completed, or a message to complete the prior survey's before continueing
if (surveyAnsArr.length-1>i){
status = surveyAnsArr[i];
};
//here we create the link to the respondents other survey's using their tokens. We also pass this survey id to the linked survey
//so the linked survey knows where to go once the respondent has completed it.
if(lastCompleted && startNew){
//create link text here
//server address + the survey id that we want to go to + the token for this respondent + LS junk + the subquestionid that this link is connected to + the this survey id, so that
//the survey that we're linking to knows where to go after it is complete (this saves the LS developer from having to handcode the survey id into each of the surveys required)
status = '<a href="'+ surveyServer + numberArr[i] + '?token='+ '{TOKEN:TOKEN}' +'&newtest=Y&lang=en&qcode='+ surveySGQAs[i] +'&returnSurvey=' + {SID} + '">Start</a>';
startNew = false; //now that we've reached the next survey that must be completed, all future sureys on the lists should not have a link
};
//if the response array matches this particular question, then it was already completed, so we can set
//the status to the completed date stored in the response array
if(surveyAnsArr.length-1==i){
lastCompleted=true;
status=surveyAnsArr[i];
};
addHtml +='<td>' + status +'</td></tr>';
};
addHtml += "</table>";
//add the table to the table wrapper we created at the beginning of this hot mess.
$(table).html(addHtml);
});
</script>
After you set up a parent survey with all the possible surveys a respondent would take, I imagine you could use a combination of the token table and relevancy equations for each survey listed in the surveyStatus question of the ParentSurvey. I imagine you could rig something up so that you would upload a variable into the token table attributes using a base 2 system that would represent any combination of the surveys the respondent should receive. For exampleI'm looking for a way to build an overview page that lists surveys my respondents are invited for, a respondent-side dashboard so to say. The intention is that respondents easily can see their current state (how many surveys completed yet, etc.) in a case where they are invited to participate in a series of surveys.
In this case, you would only need to add token and email to the Parent Survey, and JUST the token to the Child Surveys. That way you manage ALL the survey's using just the Parent Survey to send reminders/invitiations.The token tables of the surveys are identical concering Email-Adresses and tokens (i.e. respondents have the same token in all of these surveys)
I believe the current solution takes care of this.The overview page should contain a table with the following information for each survey:
Survey1: Topic (manually entered)
I can't think of a way to take care of this... Maybe if there was a way to reference OTHER survey information from the Parent Survey? If this type of functionality exists, I've never dealt with it. Worse case, you just copy/paste it into surveyStatus question text.| Survey description (ideally linked to survey)
This is an interesting problem to solve. My guess is that one could pass the survey duration at the end of a ChildSurvey BACK to the Parent Survey, and then have an equation that averages all responses in that answer field? In other words - the Parent Survey would have an additional question called surveyDuration which mimics surveyStatus. When the respondent completes the appropriate survey, it passes the duration value back to the Parent Survey, and stores it in the appropriate field in surveyDuration. Then perhaps you could average the durations of all responses for the particular survey? Sounds good in theory...| Median duration (calculated over all previous respondents of the survey)
I think most of these could be taken care of with Expression Manager. Except for maybe date of last action. That value exists primarily in the Child Survey Response table.... Maybe you could track it every time the 'start' link is clicked?| Date of Invitation/Date started/Date of last Action | Started? (Y/N)/Completed? (Y/N) | Link to Survey1