Archive

Archive for the ‘FAQ’ Category

How To View Collected GPS Data

Overview

This how-to will show you how to view your GPS data in the operations console and in the exported data.

Viewing Collected GPS Data in the Operations Console

When opening a specific interview, and moving over to its ‘Map’ tab – You would be able to see its captured GPS coordinates and specific place:

Viewing Collected GPS Data in the exported result output.

When exporting to excel with the exporting wizard, first verify that the latitude and longitude columns are enabled through the exporting wizard.

Now you can view the coordinates of each interview:

That’s it!

Visit us at: http://www.dooblo.net

Categories: FAQ, How To's

How To: Introduction to Regular Expressions (RegEx)

July 19, 2012 1 comment

Overview

Regular expressions are patterns of characters which are used in order to check if some text is matched to your requests.
A common known usage of regular expression is when demanding a valid email address in a free text question – regular expressions allows you to validate if the input is a valid email address.

RegEx Quick Reference

How To Do It?

SurveyToGo has a built-in function called IsRegEx, this function
gets two parameters:
1st parameter is the RegEx expression.
2nd parameter is the text to check.

This function returns ‘true’ if the text is valid according to the RegEx expression, or ‘false’ if the text is not valid according to the RegEx expression.

Let’s look on the email validation example.
Here is a RegEx I took from the internet for validating email addresses:

^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})\$

Just for my convenience, I have placed it inside a global variable, so I don’t need to write the whole expression when I wish to use it.
*Here is a ‘How-To’ about Global Variables

Vars[“emailRegEx]=“^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})\$”;

You can implement this global variable wherever you want in your survey.
Now, I would like to check if the answer of my Open Ended question which asks for the respondents email, is a valid email address.

I have created the following Validation Rule:

This basically checks if the RegEx is NOT valid.
And have configured it to prompt if the email is not valid.

And as you can see, I have entered a not valid email address, and the validation RegEx rule has saved the day!

Other Usages Of RegEx?

Basically RegEx can come in hand in a vast range of ways, for example:
– Validating a certain code which has to match a certain pattern (like Bar-Codes, Policy-Codes, etc’).
– Validating a certain pattern of phone number.
– And any pattern of text you have in mind.

There is a lot of info about RegEx in the internet, as this is a whole language for validating text patterns.
For quick reference of the language syntax and testing your regular expressions on your text, I would recommend using the following site:

http://rubular.com/

It has a RegEx validation tool and a quick reference for RegEx syntax.

That’s it!

Visit us at: http://www.dooblo.net

Categories: FAQ, How To's

How To Create Start\End Scripts

Overview

Start & End scripts are used in order to execute a piece of code before the question runs, or after it.
Every type of question has its own set of Start Script Box & End Script Box.
These box’s are available for writing some code.

How To Do It?

If you wish to run a piece of code right before the question is entered, you should write it in the ‘Start Scripts’:

If you wish to write a code that will run immediately as the current question is finished, you should write it in the ‘End Script’:

The ‘Validate’ button is used for validating if the code you wrote is valid in terms of correct syntax.

If not, it would prompt you with an error message explaining what is not correct, for example:

Usually Start Scripts are used when you need to manipulate the upcoming question, before it is display, such as filtering its answers according to an other questions answers.

End Scripts are usually used when you need to perform some code that depends on the current questions answers, therefore, you must execute it in the ‘End Code’ after the question was already answered.

That’s it!

Visit us at: http://www.dooblo.net

Categories: FAQ, How To's

How To Use Global Variables

Overview

If you wish to hold data in a global variable which will be available to fetch from every single place in your survey – Global variables are the answer.
Global Variables are used to store different data, making it available through all of your survey.
This how to will instruct on how to create global variables and how to use them.

How Global Variables Are Construced?

Global variable need to have to parameters:
1. The Key (the name of the variable).
2.The Value (Can be a number, a text input or a Boolean value)

For Example:

Vars[“KEY”]=VALUE;

‘Vars’ is basically declaring that this is a global variable.

Where To Create A Global Variable?

In any place you want across your survey (start & end scripts\advanced scripts\ survey init code) you can declare

How To Create A Global Variable?

Here are real examples of how you can create global variables:

Vars[“PointLimit”]=100;

Vars[“TheWinningName”]=“Jessica”;

Vars[“toStopSurvey”]=false;

Vars[“test1”]=“a”;

Vars[“test2”]=7;

As you can see, we have declared the ‘Vars’ component in order to make the system ‘know’ it is global.
We used the square bracelets, and placed the key name within.

Then we set a value to our keys.

How To Access A Global Variable?

In any place in your survey which you need to have any use of one of your global variables, you can just write it with its name, for example:

Vars[“PointLimit”]

Vars[“TheWinningName”]

Vars[“toStopSurvey”]

Vars[“test1”]

Vars[“test2”]

Like this you can use the value they hold in rules,scripts,etc’.

For Example:

{

// DO SOME NICE CODE

}

If you wish to change a global variable value, just add the ‘=’ operator and write the new value, for example:

{

}

That’s it!

Visit us at: http://www.dooblo.net

Categories: FAQ, How To's

How To Create ‘if’ Statements (Conditional Scripting)

Overview

‘if’ Statements are a basic fundamental of programming languages.
It is used for creating condition checks.
conditional statements are features of a programming language which perform different computations or actions depending on whether a programmer-specified Boolean condition evaluates to true or false
This how to will introduce you to ‘if’ sentences and show you how you can use it within survey to go.

How it is constructed?

IF
(predicate)

THEN

(consequent)

ELSE

(alternative)

Within the ‘Predicate’ place you should write the condition.
Within the ‘Consequent’ you should write the code that will be executed if the condition is ‘true’.
Within the alternative you should write the code that will be executed if the condition is ‘false’.

How it really looks like?

{

}

else

{

Prompt(“This is a test”);

}

This example will do the following:
“if the answer of question 2 equals to 5, set the answer of the current question with the value 2.
Else, Prompt a message saying ‘This is a test’ “.

‘if’ sentences in SurveyToGo are useful within Start Scripts, End Scripts and ‘Advanced Scripts’.
They are not need for ‘Entrace Rules’ & ‘Jump Rules’.

‘if’ statements are not limited to only one condition and alternative but many, although, it is not recommended to use more then 10 alternatives in the same ‘if’ statement, as some operating systems such as ‘Android’ have some limitation’s and might not process it right.
Example of several conditions:

{

x=15;

}

{

Prompt(“This is a test”);

}

{

Prompt(“This is another test test”);

}

else

{

Prompt(“Thats it”);

}

This will do the following:
if Answer of 1 is equal to 2 AND answer of 2 is equal to 3 -> input value 15 to x;

Else if : if Answer of 1 is equal to 3 AND answer of 2 is equal to 4 -> Prompt:”This is a test”

Else if : if Answer of 1 is equal to 4 AND answer of 2 is equal to 5 -> Prompt:”This is another test”

Else: -> Prompt:”This is another test”

Using an ‘if’ statement within an ‘if’ statement?

Similar to the movie Inception with the dreams, there can be an ‘if’ statement within an ‘if’ statementJ.

That’s it!

Visit us at: http://www.dooblo.net

Categories: FAQ, How To's

How To Use & Implement ‘For’ Loops

Overview

‘For’ loops are a very common function\feature which is one of the basic fundamentals of programming.
It used in most of the known programming languages and it is very useful for many different scenarios.

SurveyToGo Studio is open for usage of C# and JavaScript syntax which both have ‘For’ Loops.
This ‘How-To’ will introduce you to ‘For’ loops and will explain how to use them in SurveyToGo.

Step 1: Introduction & Structure of ‘For’ loops.

Step 2: Implementing ‘For’ loops in SurveyToGo.

Let’s go !

Step 1: Introduction & Structure of ‘For’ loops.

For loops are basically iterative loops which get 3 parameters and some code for action, here is how the structure of a ‘For’ loops looks like:

for( [Initial Expression] ; [condition] ; [Increment Expression] )

{                //Iteration Starts !

[ACTION];        //Action Code !

}                //Iteration Ends !

[Initial Expression] : This piece of code runs only once , at the moment the loop is entered.

[condition] : This piece of code is the condition which is checked each iteration before it begins.

[Increment Expression] : This piece of code is executed each time an iteration is ended.

Here is an example of how it would really be implemented:

for( var i=0 ; i<10 ; i++ )

{

}

* This loop will iterate 10 times, each time it will execute the code written. (notice I used ‘i’ in the code, which means each iteration its value will change !)

1st Param: Declaration of a variable called ‘i’ (this is in JavaScript, in C# ‘var’ should be replaced with ‘int’).

2nd Param: The condition of the loop, as long as ‘i’ value is less than 10, the loop will run.

3rd Param: Here we would usually want to increment by 1 our initialization variable every end of iteration, so the loop will meet it condition sometime and end, if the condition would not be met, the loop will keep on going forever and ever and ever…etc’.
* ‘++’ operator increments the variable from its left by 1.

Action Code (Withing the Curly Bracelets): Here you can write any code you have in mind, your only limit is your own imagination (and syntax limitations J).

Step 2: Implementing ‘For’ loops in SurveyToGo.

For loops can be implemented wherever you want\need to use them, except for entrance rules and jump rules.
You can implement them in Start\End scripts, Survey Init code, Advanced scripts, etc’.

I would show you a nice use of ‘For’ loops in SurveyToGo.
Lets say for the example that we have one multi-topic question (single choice grid) and one
Single-Choice question.
Multi-topic question will have worker names as topics, and grades as answers:

Let’s say, for example, that we want the next single choice question to show only workers which are rated less than average.
1. Excellent.
2.Good.
3.Average.
5.Horrible.

In that case we can use a ‘For’ loop that will iterate according the topics and will filter out only the ones suitable to our request, for example.
I would enter in the next question’s start script the following:

for(var i=1; i<=GetTopicCount(CurrQues1); i++)

{

{

}

}

basically what I did here is configured a loop to run from 1 until the number of topics in the previous question, incrementing ‘i’ each iteration by 1.

Each iteration I checked if the answer of Topic i, in the previous question, is less or equal to 3.
If the answer is less or equal to 3, what means Average, good or Excellent, so I would like to hide that answer, by using SetAnswerVisible, with the value of ‘i’.
* The single choice question will have the same names in the same order as answers.

Eventually it would hide the workers rated 3 or less, and will show only the workers rated 4 or 5. (Bad, horrible.)

There is no limit to what you can do with ‘For’ loops, this is just a basic example of how you can use it for basic things in SurveyToGo.

That’s it!

Visit us at: http://www.dooblo.net

How To: Add A Sketch Question

Overview

SurveyToGo studio enables you to add a question will be for sketching.
Sketching can be done either on a blank page or on an image added.

How To Do It:

1. First step, we will add a Open Ended Question (Free Text Question), and in it’s answer tab configure it to ‘Show as Sketch’:
2. Now let’s go to the questions ‘Advanced’ tab, and configure the ‘Sketch’ board to be in the maximum page size:
3. Now our Sketch question is ready, as a blank board:
4. If we wish to use it as a ‘Sketch’ on an image, we would have to add an image to this question.