GetForm

Description

Get Form (Info, Single, Multi, Grid, Grid3D, Open or Loop) from the form. Should be used designtime. Typically this function is called to get a heavy-weight Form having already retrieved a light-weight Form.

Signature
SurveySchema GetForm(string key, string projectId, FormBase form, ReadFilterSimple readFilterSimple, SchemaSourceType schemaSource)

Parameters

Name Data Type Description

key

string required

The authentication key

projectId

string required

ID of the project

form

FormBase required

Form to be retrieved

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 SurveyDesign = new SurveyDesignSoapClient();

//***************************************************
//
// Get Form from name
//
//***************************************************

// Get loop by use of name (heavy task in design, light in runtime)
SurveySchema def = SurveyDesign.GetFormByName(
	key,
	projectID,
	"l1",
	SurveyDesignUtil.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 =
	SurveyDesignUtil.NewPoetReadFilter(true,false,true,true,true);
poetReadFilter.IncludeAllForms = true;
poetReadFilter.IncludeAllNodeTypes = true;
poetReadFilter.IncludeAllLanguages = true;
def = SurveyDesign.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 =
	SurveyDesignUtil.NewReadFilter(false,false,true,true);

// Get the forms under the loop
def = SurveyDesign.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
SurveyDesign.Update(key,projectID,def);