GetFormByName

Description

Get Form (Info, Single, Multi, Grid, Grid3D, Open or Loop) from name. Should NOT be used designtime as it is very resource-demanding. Well suited and fast realtime.

Signature
SurveySchema GetFormByName(string key, string projectId, string name, ReadFilterSimple readFilterSimple, SchemaSourceType schemaSource)

Parameters

Name Data Type Description

key

string required

The authentication key

projectId

string required

ID of the project

name

string required

Name of form

readFilterSimple

ReadFilterSimple required

Filter used to specify the target

schemaSource

SchemaSourceType required

Designtime/RuntimeProduction/RuntimeTest

Response

Data Type Description

ObjectStructure containing the Form

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);