GetFormsInLoop

Description

Get Forms within a given Loop. If a parent (Loop) is specified all forms within that Loop-level is retrieved (IncludeAllForms in ReadFilter will be set to true). If parent is an object of type Root all forms that are not within any Loop is retrieved. If parent is NULL the search will be performed on all forms no matter loop-levels. In that case IncludeAllForms in ReadFilter will not be automatically set to true and it will be possible to specify form-names as a filter.

Signature
SurveySchema GetFormsInLoop(string key, string projectId, Node parent, ReadFilter readFilter, SchemaSourceType schemaSource)

Parameters

Name Data Type Description

key

string required

The authentication key

projectId

string required

ID of the project

parent

Node optional

The parent node

readFilter

ReadFilter required

Filter used to specify the target

schemaSource

SchemaSourceType required

Designtime/RuntimeProduction/RuntimeTest

Response

Data Type Description

ObjectStructure containing the Forms

Example

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

//***************************************************
//
// Get Form from name
// Get Node
// Get Forms in Loop
// Update
//
//***************************************************


// Get loop by use of name (heavy task in design, light in runtime)
SurveySchema def = authoring.GetFormByName(
	key,
	projectID,
	"l1",
	AuthoringUtil.NewReadFilterSimple(false,false,true),
	SchemaSourceType.Design);

// Point to the loop
Loop loop = (Loop)def.Root.Nodes.GetValue(0);

// If a node is retrieved in lightweight-version it can be used to get its heavyweight-version
PoetReadFilter poetReadFilter =
	AuthoringUtil.NewPoetReadFilter(true,false,true,true,true);
poetReadFilter.IncludeAllForms = true;
poetReadFilter.IncludeAllNodeTypes = true;
poetReadFilter.IncludeAllLanguages = true;
def = authoring.GetNode(key,projectID,loop,poetReadFilter);

// Point to the same node, but now including languages
loop = (Loop)def.Root.Nodes.GetValue(0);

// Create new readfilter
ReadFilter readFilter =
	AuthoringUtil.NewReadFilter(false,false,true,true);

// Get the forms under the loop
def = authoring.GetFormsInLoop(key,projectID,loop,readFilter,SchemaSourceType.Design);

// Change the name of the first hit
FormBase form = (FormBase)def.Root.Nodes.GetValue(0);

// Add to the existing name of the form
form.Name += "_new";

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