ISurvey Interface |
Namespace: AskiaCore
The ISurvey type exposes the following members.
Name | Description | |
---|---|---|
Categories |
Collection of categories for this survey
| |
Controls |
Collection of controls for this survey
| |
CreatedAt |
DateTime the record was created at
(Inherited from IRecordEntity.) | |
CreatedBy |
Id of the user which created the record
(Inherited from IRecordEntity.) | |
DefaultControls |
Collection of default controls for this survey
| |
DefaultLanguageId |
Id of the survey default Language
(Inherited from ISurveyInformation.) | |
DefaultPageTemplateId |
Returns the id of the survey default page template
(Inherited from ISurveyInformation.) | |
DefaultPageTemplateProperties |
Collection of default page template properties for this survey
| |
DeletedAt |
DateTime at which the record was last deleted
(Inherited from IRecordEntity.) | |
DeletedBy |
Id of the user which last deleted the record
(Inherited from IRecordEntity.) | |
Description |
Description of the survey
(Inherited from ISurveyInformation.) | |
Elements |
Collection of elements for this survey
| |
Id |
Id of the record
(Inherited from IRecordEntity.) | |
Languages |
Collection of languages for this survey
| |
LastError |
Last error that occurred
(Inherited from IRecordEntity.) | |
Name |
Name of the survey
(Inherited from ISurveyInformation.) | |
PageTemplates |
Collection of page templates for this survey
| |
PortalId |
Id of the survey in AskiaPortal database
(Inherited from ISurveyInformation.) | |
Questions |
Collection of questions for this survey
| |
Resources |
Collection of resources for this survey
| |
Routings |
Collection of routings for this survey
| |
Scenarios |
Collection of scenarios for this survey
| |
ThemeProperties |
Collection of theme properties for this survey
| |
UpdatedAt |
DateTime at which the record was last updated
(Inherited from IRecordEntity.) | |
UpdatedBy |
Id of the user which last updated the record
(Inherited from IRecordEntity.) | |
Version |
Gets the version of the engine that created the survey
|
Name | Description | |
---|---|---|
ApplyTheme |
Applies the given theme
| |
CheckAll |
Checks all the survey
| |
CheckElementsStructure |
Checks the integrity of the elements structure
| |
CheckQuestionsStructure |
Checks the integrity of the questions structure
| |
CheckResourceFileLocationAlreadyExist |
Checks if the given resource file location already exist
| |
CheckRoutings |
Checks the routings
| |
CompileScript(RoutingActionType, String) |
Compiles an Askia script.
| |
CompileScript(RoutingConditionType, String) |
Compiles an Askia script.
| |
CopyAsQuestionsTemplate |
Copies the current survey as a questions Template
| |
CopyAsSurveyTemplate |
Copies the current survey as a survey Template
| |
CreateConditionFromScript |
Creates an assisted condition given a script.
| |
CreateInterview |
Creates an interview from this survey
| |
CreateInterview(Int32) |
Creates an interview from this survey
| |
CreateScriptFromCondition |
Creates a script given an assisted condition.
| |
CreateSubSurveyForScreen |
Creates a sub-survey for the variables in the page element.
| |
Delete |
Deletes the record in the database
(Inherited from IRecordEntity.) | |
ExtractResources |
Extract resources to their appropriate location ResourcesPath | |
FindResponse |
Retrieve a response from within the questions of the
survey given its id
| |
FindResponses |
Retrieve responses from within the questions of the
survey given their ids
| |
GetMessages |
Returns a collection of the messages for the
current language
| |
IndentQuestions |
Indent questions
| |
InsertFromQuestionsTemplate |
Insert questions from a given template to a specific destination
| |
IsDeleted |
Indicates if the record is flagged as deleted
(Inherited from IRecordEntity.) | |
IsLoaded |
Checks if the record is successfully loaded from the database
(Inherited from IRecordEntity.) | |
LoadFromXML |
Reads from memory in XML format
| |
LoadFromXMLFile |
Reads from file in XML format
| |
LoadInterview |
Loads a specific interview
| |
MergeQuestionPages |
Merge questions from the given id's range into the same page
| |
MoveElement |
Move element to a given destination
| |
MoveQuestions |
Move questions to a given destination
| |
MoveRoutings |
Move routings to a given destination
| |
ReadFromExchangeFormat(Byte) |
Reads from file in exchange format (.qex)
| |
ReadFromExchangeFormat(String) |
Reads from file in exchange format (.qex)
| |
ReadFromExchangeFormat(String, String) |
Reads from file in exchange format (.qex)
| |
Reload |
Reloads the record
(Inherited from IRecordEntity.) | |
ResetResourcePath |
Empties the Live and test path so it works in a published survey
| |
Restore |
Restores the deleted record in the database
(Inherited from IRecordEntity.) | |
RunScript |
Runs an Askia script
| |
Save |
Saves the record in the database
(Inherited from IRecordEntity.) | |
SaveAll |
Saves all the survey recursively
| |
SaveRoutings |
Saves a batch of routings in one go, all or nothing.
| |
SaveToExchangeFormat(Byte) |
Saves to memory in exchange format
| |
SaveToExchangeFormat(String) |
Saves to file in exchange format (.qex)
| |
SaveToExchangeFormat(String, String) |
Saves to file in exchange format (.qex)
| |
SaveToXML |
Saves to memory in XML format
| |
SaveToXMLFile |
Saves to file in XML format
| |
SetDefaultLanguage |
Set the default language ID for the whole survey
| |
SetDefaultPageTemplate |
Set the default pages template id for the whole survey
| |
SetName |
Sets the name of the survey
(Inherited from ISurveyInformation.) | |
SplitQuestionPages |
Split merged questions from the given id's range
| |
TestCode |
Internal debug function
| |
TransformIntoQuestionsTemplate |
Promotes the current survey to a questions Template
| |
TransformIntoSurveyTemplate |
Promotes the current survey to a survey Template
| |
UnindentQuestions |
Unindent questions
| |
Upgrade |
Upgrades survey to latest version
|
The survey instance is created for a given context.
You can have multiple instances representing the same survey with different contexts,
they all will internally interact with the same reference of the survey data.
The concurrent management of survey with context is mostly done to allows edition by multiple users at the same time on the same survey.
Use two different survey instances to manipulate the same survey data
using AskiaCore; namespace MyApp { public class MyProgram { static void Main() { // Initialize the database connection string (Where the survey will be stored) Persistent.InitDatabaseConnection("connectionstring", DatabaseTypes.PORTAL); // Create a context with the user 1 IContext contextA = ContextFactory.Create(); contextA.UserId = 1; contextA.SessionId = "xxxxx-xxxxx-xxxxx-xxxxxx"; contextA.LanguageId = 2057; // Edit the survey with this language (English) // Get the survey with the AskiaPortal id 1 // and with the contextA ISurvey surveyWithContextA = SurveyFactory.Get(contextA, 1); IQuestion ageContextA = surveyWithContextA.Questions["age"]; Console.WriteLine(ageContextA.Responses.Count); // -> Output: 4 // Create a context with the user 2 IContext contextB = ContextFactory.Create(); contextB.UserId = 2; contextB.SessionId = "yyyyy-yyyyy-yyyyy-yyyyy"; contextB.LanguageId = 1036; // Edit the survey with this language (French) // Get the survey with the AskiaPortal id 1 // and with the contextB ISurvey surveyWithContextB = SurveyFactory.Get(contextB, 1); IQuestion ageContextB = surveyWithContextB.Questions["age"]; IResponse response ageContextB.Responses.Create(); response.MainCaption = "50+"; // Save all changes using the context B surveyWithContextB.SaveAll(); // The survey with the context A and the survey with the context B // are both up-to-date with the additional response Console.WriteLine(ageContextA.Responses.Count); // -> Output: 5 Console.WriteLine(ageContextB.Responses.Count); // -> Output: 5 // Release the database connection Persistent.EndDatabaseConnection(); } } }