Lighthouse Studio

System Functions

Lighthouse Studio includes a number of functions that can be used to display information to the screen, within skip logic, within constructed list logic, and in other fields within the Lighthouse Studio menu system.

 

The "Sawtooth Script" column below gives the syntax for System Functions.  

                 

Sawtooth Script:

Description:

Answered(QuestionName)

Is true if the question was answered by the respondent, false otherwise.

More info

BlockPosition()

Returns the current block number when used within a Randomized Block sequence.

BooleanToNumber(Boolean)

Converts a variable of type "Boolean" to type "Number" for use in Sawtooth Scripting.

Browser()

Returns information on respondent's browser.

CheckSelect(QuestionName, Value)

For use within Free Format questions.  Returns the HTML for a checkbox, including the specific HTML compatible with Graphical Select buttons. More info.

Debug()

Returns debug information that assists you when testing the questionnaire.

DisplayTotal (FirstQuestionName,

 LastQuestionName, Width)

Returns a grayed out box displaying the total of all questions beginning with FirstQuestionName and ending with LastQuestionName.

More info.

EncodeForURL(QuestionName)

Converts characters that are not valid for use in URLs to URL-supported strings.

GetValue(QuestionName)

Returns value from data record for the given variable name More info.

GraphicsPath()

Returns the system graphics path.

IPAddress()

Returns respondent's IP Address.

JavaScript()

Is true if they have JavaScript, false otherwise.

More info

Label(QuestionName)

Returns the label that is associated with the answer to a single select response type question.

LinkButton("URL")

Returns an HTML "submit" button (this helps in linking surveys).

NumberToBoolean(Number)

Converts a variable of type "Number" to type "Boolean" for use in Sawtooth Scripting.

NumberToString(Number)

Converts a variable of type "Number" to type "String" for use in Sawtooth Scripting.

NumChecked(QuestionName)

Returns number of response options checked.  QuestionName can be a select checkbox (i.e. Q1), a row or column of checkboxes (i.e. Q1_r1 or Q1_c1), or a Free Format question (i.e. Q1_checked).

OperatingSystem()

Returns information on Respondent's operating system.

PageNumber()

Returns current page number.

PageTime(StartPage)

PageTime(StartPage, EndPage)

Returns the time (in seconds) between StartPage and EndPage (integer values). More info

PopUp("Link Text", "File.htm", Width, Height)

Returns the HTML for a JavaScript pop-up. File.htm is assumed to be in the graphics folder.  Or, File.htm can be elsewhere if referenced with full http:// path. More info

ProgressBar()

Returns the progress bar to the screen. Typically placed in the Global Header or Global Footer.

ProgressBarOff()

Turns off the progress bar on the page where it is placed.

ProgressBarSet(Value)

Sets the progress bar to the Value.

QuestionName()

Returns the name of the current question.  May be used in Header 1, etc. sections, and also in skip patterns.

RadioSelect(QuestionName, Value)

For use within Free Format questions.  Returns the HTML for a radio button, including the specific HTML compatible with Graphical Select buttons. More info.

RandNum(Seed)

RandNum(Seed, Min#, Max#)

 

Returns a random number.  If one parameter is given, returns a uniform random decimal value between 0 and 1.  If three parameters are given, returns a random integer value from Min# to Max#.  Seed must be an integer.  

More info.

RemovePrevious()

Removes the Previous button from the page where it is placed.

RespNum()

Returns the internal respondent number, a unique number that identifies the respondent.

ScreenWidth()

Returns the width of the respondent's browser screen (in pixels).  This can be used to detect if the respondent is on a mobile device.

SetValue(QuestionName, Value)

Stores to the data record the value for the given QuestionName. Warning: will overwrite existing data in the target QuestionName. More info.

Shown(QuestionName)

Is true if the question has been seen by the respondent, or false if the question was not seen by the respondent.

More info

StringToNumber(String)

Converts a variable of type "String" to type "Number" for use in Sawtooth Scripting.

StudyName()

Returns the name of a study.

SysRand()

SysRand(Min#, Max#)

Returns a random number seeded by the system clock (different seed every time instruction is encountered).

SystemTime()

Returns a number representing the current time (number of non-leap seconds since January 1, 1970).

ToolTip("LinkText", "HelpText")

ToolTip("LinkText", "HelpText", Width)

ToolTip("LinkText", "HelpText", Width,
 Height)

Used for creating a "tooltip" during mouseover. More Info.

TotalPages()

Returns total number of pages in study.

UserAgent()

Returns respondent's User Agent.

WriteLog("Message")
WriteLog("Message", Type)

Writes a message to the Survey Log.  Type (optional) is a number representing the type of log entry.  For Type enter 1 for an "error", 2 for a "warning", and 3 for a "notice".

 

For additional flexibility in Sawtooth Scripting, see the Unverified Perl documentation.

 


Notes on use of GetValue (QuestionName) function:

 

The GetValue (QuestionName) function returns the value of the question as recorded in the database.  It can be used with various questions:

 

Numeric, Open-end or Select (radio) question types:

[%GetValue(G3)%] where G3 is the name of a question

 

Select (check box) question types:

[%GetValue(G3_1)%] where G3 is the name of a question, the number after the underscore indicates the response item#, and the value returned is "1" (checked) or "0" (not checked)

 

Grid question type

[%GetValue(G3_r2_c3)%] where G3 is the name of a grid question and the response is in a particular row (_r#) and column (_c#)

 

Note: [%QuestionName%] is the same as [%GetValue(QuestionName)%].  So [%G3%] will return the value of question G3.

 

See also SetValue().

Created with Help & Manual 8 and styled with Premium Pack Version 4 © by EC Software