GetConditionBranch

Description

Get nodes within a condition

Signature
SurveySchema GetConditionBranch(string key, string projectId, Condition parent, PoetReadFilter poetReadFilter, bool trueBranch)

Parameters

Name Data Type Description

key

string required

The authentication key

projectId

string required

ID of the project

parent

Condition optional

Condition

readFilter

PoetReadFilter required

Filter used to specify the target

trueBranch

bool required

True: True-branch

Response

Data Type Description

ObjectStructure containing the Nodes

Example

// Create instance of the webservice
var authoring = new AuthoringSoapClient();

//***************************************************
//
// Get Nodes
// Get ConditionBranch
// Update
//
//***************************************************

// Make a new poetReadFilter
PoetReadFilter poetReadFilter =
	AuthoringUtil.NewPoetReadFilter(false,false,true,true,false);

// Only conditions
ArrayList nodeTypes = new ArrayList();
nodeTypes.Add(NodeType.Condition);
poetReadFilter.NodeTypes = (NodeType[])nodeTypes.ToArray(typeof(NodeType));

// Get all conditions in the project
SurveySchema def = authoring.GetNodes(key,projectID,null,poetReadFilter);

// Pick the first condition
Condition condition = (Condition)def.Root.Nodes.GetValue(0);

// Set the readfilter to include all nodetypes
poetReadFilter.IncludeAllNodeTypes = true;

// Get All Truenodes (nodes under the 'IF THEN'-part) of the condition
def = authoring.GetConditionBranch(key,projectID,condition,poetReadFilter,true);

// Add new node to place under the THEN-part
SingleForm single = AuthoringUtil.NewSingleForm("newSingle");

ArrayList nodes = new ArrayList((Array)def.Root.Nodes);
nodes.Add(single);
def.Root.Nodes = (Node[])nodes.ToArray(typeof(Node));

// Update
authoring.Update(key,projectID,def);