Difference between revisions of "QAS getCallStack"

From Catglobe Wiki
Jump to: navigation, search
(QAS_getCallStack)
(QAS_getCallStack)
Line 172: Line 172:
  
 
{90462158,{90462158,90462159,90462160},{{{6432,90462158,D_returnBack},{6433,90462159,Q1}},{{6433,90462159,D_returnBack},{6458,90462160,Q1}}}}
 
{90462158,{90462158,90462159,90462160},{{{6432,90462158,D_returnBack},{6433,90462159,Q1}},{{6433,90462159,D_returnBack},{6458,90462160,Q1}}}}
 +
 +
/*
 +
 +
 +
 +
{
 +
90462158, //QAS_CALL_STACK_ANSWER_SHEET_CONTEXT_ID
 +
{90462158,90462159,90462160}, // QAS_CALL_STACK_ANSWER_SHEET_IDS
 +
{ // QAS_CALL_STACK_FRAMES
 +
{
 +
{6432,90462158,D_ReturnBack},//QAS_STACK_FRAME_CALLER
 +
{6433,90462159,Intro} // QAS_STACK_FRAME_CALLEE
 +
},
 +
{
 +
{ //QAS_STACK_FRAME_CALLER
 +
6433,// QAS_STACK_FRAME_QUESTIONNAIRE_RESOURCE_ID
 +
90462159,// QAS_STACK_FRAME_ANSWER_SHEET_ID
 +
D_ReturnBack // QAS_STACK_FRAME_QUESTION_LABEL
 +
},
 +
{6458,90462160,Intro}
 +
}
 +
}
 +
}
 +
 +
*/
  
  

Revision as of 10:47, 11 April 2012

QAS_getCallStack

This function makes it possible for the script writer to peek into the current answer sheet call stack. The function requires an answer sheet context to be present which only exists for CG Scripts executed in dummy questions. The array which is returned from this function can be used to reset specific answer sheets on the call stack.

Syntax

QAS_getCallStack()

Arguments

No

Return type

array. The array returned from QAS_getCallStack has the following structure:

Index

Property name

Data type

Description

0

QAS_CALL_STACK_ANSWER_SHEET_CONTEXT_ID

number

The answer sheet id for the initial answer sheet, this id is also known as the answer sheet context id.

1

QAS_CALL_STACK_ANSWER_SHEET_IDS

array

All the answer sheet ids currently on the answer sheet call stack, where the first answer sheet id in the array correspond to the caller answer sheet at the bottom of the call stack.

This array always contains minimum one element, which is the initial answer sheet id.

2

QAS_CALL_STACK_FRAMES

array

This array contains an array for each stack frame on the call stack, including information about caller and callee, where the stack frame in the array correspond to the stack frame at the bottom of the call stack.

The property QAS_CALL_STACK_FRAMES consists of arrays which we refer to as call stack frames, each call stack frame consists of two arrays; one for the caller and one for the callee in the following way:

Index

Property name

Data type

0

QAS_STACK_FRAME_CALLER

array

1

QAS_STACK_FRAME_CALLEE

array

And caller and callee each points to an array of the following structure:

Index

Property name

Data type

Description

0

QAS_STACK_FRAME_QUESTIONNAIRE_RESOURCE_ID

number

This is the questionnaire resource id for the caller or callee depending on which part this array exists in.

1

QAS_STACK_FRAME_ANSWER_SHEET_ID

number

This is the answer sheet id for the caller or callee depending on which part this array exists in.

2

QAS_STACK_FRAME_QUESTION_LABEL

number

This is the question label for the caller or callee depending on which part this array exists in.

Example


array a=QAS_getCallStack();

//returned

{90462158,{90462158,90462159,90462160},{{{6432,90462158,D_returnBack},{6433,90462159,Q1}},{{6433,90462159,D_returnBack},{6458,90462160,Q1}}}}

/*


{ 90462158, //QAS_CALL_STACK_ANSWER_SHEET_CONTEXT_ID {90462158,90462159,90462160}, // QAS_CALL_STACK_ANSWER_SHEET_IDS { // QAS_CALL_STACK_FRAMES { {6432,90462158,D_ReturnBack},//QAS_STACK_FRAME_CALLER {6433,90462159,Intro} // QAS_STACK_FRAME_CALLEE }, { { //QAS_STACK_FRAME_CALLER 6433,// QAS_STACK_FRAME_QUESTIONNAIRE_RESOURCE_ID 90462159,// QAS_STACK_FRAME_ANSWER_SHEET_ID D_ReturnBack // QAS_STACK_FRAME_QUESTION_LABEL }, {6458,90462160,Intro} } } }

  • /


Availability

Version 5.9.5