How to: Access Various Engine Components From Within a CQRP?

Overview

When writing a Custom Question Rendering Package (CQRP) you sometimes need access to the SurveyToGo logic functions and components. In this guide we examine how to access the following components:

  1. The SurveyToGo User logic functions
  2. The SurveyToGo Global variables (Vars) object 

Accessing the SurveyToGo User Logic functions

You can access many of the SurveyToGo logic functions through this syntax: 

STG.getUL().XXX

where XX represents the function you wish to call so for example, in our CQRP example we used this syntax to retrieve the answer of a question using the Answer() function in the STG_Loaded function:
 CQRP-function.png

Please note that some functions might not work correctly due to the differences in the calling mechanisms allowed from with JS. In case you have a specific question about a function please contact the Dooblo support team. 

Accessing the Global Variables (Vars) object

If you need to access the Vars object, it is possible but you will need to use the following functions to do so:

Retrieving the value of a Vars entry:

If (STG.getVars().GetValue(“valName”)….

The "valName" should be replaced with the Vars entry you wish to retrieve.

Setting the value of a Vars object from within JS:

STG.getVars().SetValue(“valName”, “value”);

The "valName" and "value" need to be replaced accordingly.

 

That's It!

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

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.