Home > Survey Logic > (Survey Logic) Chapter 5 – Built-In Functions

(Survey Logic) Chapter 5 – Built-In Functions

Back to Table Of Contents
Back to Chapter 4 – Jump (Branch) Rules

About Built-In Functions

SurveyToGo includes many built-in functions to help you accomplish as many tasks as possible with easy.

You can get a complete list of functions by sending an email to support@dooblo.net.

Partial list of Built-In Functions

Question types: T/F – True False, N – Numeric, A – Any, D – Date, S – Text

Function Description T Parameters Example
Questions
Equals(QuesIdx, Value) The answer to question QuesIdx is Value T/F QuesIdx – Index of question

Value – The value to check

Equals (5,4)

Checks if the answer to question 5 was 4.

Equals (5,“good”)

Checks if the answer to question 5 was “good”.

Answered(QuesIdx) Question QuesIdx was answered and not skipped. T/F QuesIdx – Index of the question. Answered(5)

Question 5 has an answer.

NotAnswered(QuesIdx) There is no answer for QuesIdx. T/F QuesIdx – Index of the question. NotAnswered(QuesIdx)

Question 5 has no answer.

Contains(QuesIdx, Value) Answer to question QuesIdx contains the value Value. This function can be applied to either FreeText, MultiTopics, Matrix or MultiSelect questions. T/F QuesIdx – Index of question

Value – The value to check

Contains(5, “good”)

Answer to question 5 contains the word “good”.

Contains(5, 3)

MultiTopics/Matrix: The 3rd option was selected in at least one topic.

MultiSelect: The 3rd option was selected among others.

NotContains(QuesIdx,
Value)
The exact opposite of the Contains function T/F See the Contains function See the Contains function
NumOfChoices(QuesIdx) The number of choices chosen in QuesIdx. Applies to MultiSelect questions. N QuesIdx – Index of question. NumOfChoices(5)>2

The number of selected options in the MultiSelect question 5, is bigger than 2.

AnswerChoice(QuesIdx, ChoiceIdx) The answer index to the topic ChoiceIdx in question QuesIdx. Applies to MultiTopic questions. N/S QuesIdx – Index of question.

ChioceIdx – Topic index.

AnswerChoice(5,3)==7

The answer index to topic 3 of question 5 was 7.

ContainsSpecificRate(QuesIdx, Value, TopicIdx) The answer index to the topic TopicIdx is Value. Applies to MultiTopic or Rating questions. T/F QuesIdx – Index of question.

Value – Value to check.

TopicIdx – Index of the topic.

ContainsSpecificRate(5, 7, 3)

The answer index to topic 3 of question 5 was 7

NotContainsSpecificRate(QuesIdx, Value, TopicIdx) The exact opposite of NotContainsSpecificRate T/F See the NotContainsSpecificRate function. See the NotContainsSpecificRate function.
Answer(QuesIdx) Returns the value of the answer to question QuesIdx. Applies to FreeText, Numeric, DateTime and MultiChoice questions. A QuesIdx – Index of the question. Answer(5) == “good”

Answer to question 5 is “good”.

Answer(5) == 3

MultiChoice: Index of answer to question 5 is 3.

Numeric: Answer to question 5 is 3.

Answer(5) > 3

MultiChoice: Index of answer to question 5 is greater than 3.

Numeric: Answer to question 5 is greater than 3.

AnswerText(QuesIdx, AnswerIdx) The text label of the answer index AnswerIdx of question QuesIdx.

Applies to MultiChoice or MultiTopic questions.

S QuesIdx – Index of the question.

AnswerIdx – Index of the answer/topic.

AnswerText(5, 3)

MultiChoice: The text of the 3rd option in question 5.

MultiTopics: The text of the 3rd topic in question 5.


CurrQues Returns the index of the current question. Useful for writing cleaner expressions that refer to the current question, instead of using the actual question index. N Answer(CurrQues)

Returns the answer to the current question. Refer to the Answer function for more info.

FilterAnswersByAnswers(TargetQuestionIdx, SourceQuestionIdx) The answers of the question TargetQuestion are filtered based on the answers of question SourceQuestion.

Note both questions have to have the same answers

S TargetQuesIdx – Index of the target question.

SourceQuesIdx – Index of the source question

FilterAnswersByAnswers(CurrQues, 3)

MultiSelect: The answers of this question will only be the answers chosen in Q3.


Subject
SubjectProp(PropName) Returns the subject property with the name of PropName. A PropName – Name of the subject property. SubjectProp(“Gender”) == “Male”

The value of the subject property named “Gender” equals to “Male”.

SubjectProp(“Age”) >= “Male”

The value of the subject property named “Age” is greater or equal to 18.

ExternParam(ParamName) Returns the value of the external parameter ParamName. A ParamName – The external parameter.
ExternParam(“Age”) < 18

The value external parameter “Age” is less than 18.

Utility

Date(Date) Returns a date type value of the supplied Date. Mostly used when comparing values of functions that return dates. D Date – The date you want to represent.
Answer(5) > Date(“5/5/2005”)

The answer to the date question 5, is a date that is greater than 5/5/2005.

Today Returns the date of today. D Answer(5) > Date(Today)

The answer to the date question 5, is a date that is greater than the date of today.

Now Returns the current time. D Now > Date (“22:04”)

The current time is greater than 22:04.

IsPlatform(Platform) Returns whether the current platform running the survey is Platform. Mostly used to run certain questions only on certain platforms for surveys that are being run on multiple platforms. T/F Platform – The platform to check. Can be any of the following:

ePlatform.Web

ePlatform.PC

ePlatform.PDA

ePlatform.Mobile

ePlatform.All

IsPlatform(ePlatform.PDA)

Returns whether the current platform running the survey is the PDA.

Visual
SetText(QuesIdx, Value) Sets the text of the question QuesIdx. Applies to all questions. QuesIdx – Index of the question.

Value – The text to set as the question text.

SetText(5, “What is your name?”)

Sets the text of question 5 to be “What is your name”.

SetTextFormat(QuesIdx,Value1[,Value2,Value3,…]) Set the text of the placeholders inside the question text. The list of values should match corresponding {0}, {1},{2}… elements inside the question text.

Applies to all questions.

QuesIdx – Index of the question.

Value1 – The text to set instead of the “{0}” found in the question.

Value2 – The text to set instead of the “{1}” found in the question.

Value3 – The text to set instead of the “{2}” found in the question.

SetTextFormat(5,”John”,”Smith”)

If the text of question 5 was “Hello {0} {1}” then the text of question 5 will become: “Hello John Smith”.

SetAnswer(QuesIdx,Value) Sets the answer of a text question to be Value. Applies to FreeText questions. Can be used to set the default answer to the question. QuesIdx – Index of the question.

Value – The text to set as the answer text.

SetAnswer(5,”ABC”)

Sets the answer to question 5 to be “ABC”.

SetAnswer(QuesIdx,Value1[,Value2,Value3,…]) Sets the answer(s) of MultiChoice, Numeric, MultiSelect or MultiTopic questions. QuesIdx – Index of the question.

Value1 – The option to set.

Value2 – The option to set.

Value3 – The option to set.

SetAnswer(5,3)

Numeric: Sets the answer to question 5 to be 3.

MultiChoice: Sets the 3rd option in question 5.

MultiSelect: Selects the 3rd option in question 5.

SetAnswer(5,3,7,8)

MultiSelect: Selects the 3rd , 7th and 8th option in question 5.

MultiTopics: Sets the 3rd option of topic 1, the 7th option of topic 2 and the 8th option in topic 3.

TopBanner.Text =
Value
Sets the text of the top banner in the survey Value – Text to be set as the top banner text. TopBanner.Text =
“Satisfaction Survey”

Sets the text of the top banner to “Satisfaction Survey”.

TopBanner.Color =
Value
Sets the color of the top banner in the survey Value – The color of the top banner. Can be one of the colors mentioned in Appendix A – Colors. TopBanner.Color =
Color.Blue

Sets the color of the top banner text to blue.

TopBanner.BackColor =
Value
Sets the background color of the top banner in the survey Value – The background color of the top banner. Can be one of the colors mentioned in Appendix A – Colors. TopBanner.BackColor =
Color.White

Sets the background color of the top banner text to White.

TopBanner.FontName =
Value
Sets the font of the text of the top banner in the survey Value – Font name to use. TopBanner.FontName =
“Tahoma”

Sets the font of the top banner to be “Tahoma”.

TopBanner.FontSize =
Value
Sets the font size of the top banner text in the survey Value – The actual size of the font. TopBanner.FontSize =
8

Sets the font size to 8.

TopBanner.FontStyle =
Value
Sets the font style of the top banner. Value – Style to use. Can be one of the following:

FontStyle.Bold

FontStyle.Italic

FontStyle.Regular

FontStyle.Strikeout

FontStyle.Underline

TopBanner.FontStyle =
FontStyle.Bold

Sets the font style of the top banner to bold.

TopBanner.Visible =
Value
Controls whether the top banner is visible or not. Value – Set to either True or False. TopBanner.Visible =
True

Makes the top banner visible.

 

 

Back to Table Of Contents

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

Categories: Survey Logic
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: