Survey

This custom control shows a survey given a properly formatted data source. A survey consists of one or more sections. Each section consists of one or more questions. A question has a certain input type. Questions can be invisible until a specified condition is fulfilled, e.g. a value in a previous question must be larger than a certain amount.

Properties

Details

  • Name, the name of the control.

General

  • Width, the width of the control.

  • Visible, whether the control is shown.

  • Enabled, whether the control is enabled.


Events

  • Answer, the entered answer for the survey item since the last OnAnswerChanged event triggered.

  • Answer Remark, the entered answer remark for the survey item since the last OnAnswerRemarkChanged event triggered.

  • Button Name, the name of the button that the user clicked on for the survey item since the last OnCustomButtonClicked event triggered.

  • Question, the question text from the survey item since the last event triggered.

  • Question ID, the question ID from the survey item since the last event triggered.

  • Question Mandatory, whether the question from the survey item since the last event triggered is mandatory or not.

  • DataType, the datatype from the survey item since the last event triggered.


Data Source

  • SmartObject, the smartobject that will be used when the populate method is executed for this control.

  • Method, the smartobject method that will be used when the populate method is executed for this control.

  • Value, the value reported in events when the user interacts with a survey item.

  • Item Answer, the survey item’s answer entered by the user.

  • Item Answer Watermark, the text displayed when no answer is set (see Item Answer).

  • Item Answer Remark, the survey item’s answer remark entered by the user.

  • Item Answer Remark Watermark, the text displayed when no answer remark is set (see Item Answer Remark).

  • Item Control Type, the type of answer a user must enter. The following values are supported:

    • Calendar

    • Checkbox

    • CheckboxList

    • Dropdown

    • Grid, see grid control for more details.

    • PickerMulti

    • PickerSingle

    • RadioButtonList

    • TextArea

    • TextBox

  • Item DataType, the data type of that the provided answer must be. Certain control types can only be used with certain control types. (see: Item Control Type). The following values are supported:

    • Boolean (ControlType: Checkbox)

    • Date (ControlType: Calendar)

    • DateTime (ControlType: Calendar)

    • Decimal (ControlType: TextBox)

    • Guid (ControlType: TextBox)

    • Json (ControlType: TextBox, TextArea)

    • Number (ControlType: TextBox)

    • Smo, to be used in conjunction with Item Smo ID, Item Smo Method Name, Item Smo ID Property Name & Item Smo Display Property Name. (ControlType: CheckboxList, Dropdown, Picker, RadioButtonList)

    • Text (ControlType: TextBox, TextArea)

    • Time (ControlType: Calendar)

    • Xml (ControlType: TextBox, TextArea, Grid)

  • Item Parent Visibility Condition, the operator that will be used in the visibility condition (to be used in conjunction with Item Condition Value & Item Parent Question ID). The following values are supported:

    • Answered, the parent’s answer must have any value (watermark excluded). The property `Item Condition Value`_ is not used in this case.

    • EQ, the parent’s answer must be equal to the condition value.

    • GT, the parent’s answer must be greater than to the condition value.

    • GTE, the parent’s answer must be greater than or equal to the condition value.

    • LT, the parent’s answer must be less than to the condition value.

    • LTE, the parent’s answer must be less than or equal to the condition value.

    • NEQ, the parent’s answer must not be equal to the condition value.

  • Item Question ID, the ID that will be used for a survey item’s question. This can be the same property as Value.

  • Item Question IsMandatory, the boolean that will be used to determine if a survey item’s question is mandatory. This property is used for the methods IsSurveyComplete & ValidateQuestions.

  • Item Question Text, the text that will be used for a survey item’s question.

  • Item Question Remark. the optional remark that will be shown below the question for a survey item’s question.
    If this value is null it will not be shown on the survey item.

  • Item Section Name, the section’s name that will be display for all survey item’s with teh same section ID (see : Item Section ID). This value can be empty in the data source.

  • Item Section ID, the ID that will be used to group question together. If this is empty than the question will be grouped with all other questions that have an empty section id.

  • Item Smo ID, the SmartObject ID that will be used to retrieve data for this question. This value will be ignored if the survey item’s datatype (see: Item Section ID) is not Smo.

  • Item Smo Method Name, the SmartObject method name that will be executed when retrieving data for this question. This value will be ignored if the survey item’s datatype is not Smo (see: Item DataType).

  • Item Smo Inputs, the SmartObject’s properties and values that will be used as inputs when retrieving data for this question. This value will be ignored if the survey item’s datatype is not Smo (see: Item DataType). The format that should be used is: property1=value1;property2=value2.

  • Item Smo ID Property Name, the return property of Item Smo ID that is stored in the answer for a question. This value will be ignored if the survey item’s datatype is not Smo (see: Item DataType).

  • Item Smo Display Property Name, the return property that is used to display values from Item Smo ID. This value will be ignored if the survey item’s datatype is not Smo (see: Item DataType).

  • Item Smo Sort Property Name, the SmartObject’s properties that will be used to sort the results on. Multiple values can be provided by seperating them with a semicolon. This value will be ignored if the survey item’s datatype is not Smo (see: Item DataType).

  • Item Smo Sort Direction, the SmartObject’s property that will determine the sorting direction. This value will be ignored if there are no sorting properties found. (see: Item Smo Sort Property Name). Valid values are:

    • asc, the results will be sorted ascending. (default)

    • desc, the results will be sorted descending.


Item Button X

A button that will be displayed on each question. An event will be triggered when the user selects a button. When multiple buttons are configured, they will be displayed left to right start from the lowest button number.

  • Name, the name of the button, all five buttons should have a unique name. This is used in the OnCustomButtonClicked event.

  • Icon Unicode, the Font Awesome unicode char that will be used to display the button.

  • Color, the background color for this button. This property is optional.

  • Text Color, the icon’s color for this button. This property is optional.

  • Only Show If Answered, only show this button on a survey item once an answer is provided.

  • Only Show when datatype in, only show this button on a survey item’s datatype is one of the provided datatypes. The value must be a ‘;’ seperated list, e.g.: Text;Smo.

  • Allowed In App, this property determines if the button can be diplayed and used in the k2 business app.


Events

  • Initialized

  • OnAnswerChanged, all Events properties will be updated with data from the affected survey item, apart from button name.

  • OnAnswerRemarkChanged, all Events properties will be updated with data from the affected survey item, apart from button name.

  • OnCustomButtonClicked, all Events properties will be updated with data from the affected survey item.


Methods

  • IsSurveyComplete

    • MandatoryQuestionsOnly, whether all questions should be checked or only questions that are marked as mandatory (see: Item Question IsMandatory). Optional parameter, default: false

  • HideCustomButton

    • name, the name of the button to hide (see: Item Button).

  • ShowCustomButton

    • name, the name of the button to show (see: Item Button).

  • SetQuestionsReadOnly

    • ReadOnly, disables/enables the answer and answer remark fields for each survey item. All other items of the survey will still function normally.

  • ValidateQuestions

    • MandatoryQuestionsOnly, whether all questions should be validated or only questions that are marked as mandatory (see: Item Question IsMandatory). Optional parameter, default: false


Screenshots

Browser:
Example Section - 3 Item buttons, 1 question answered
../../_images/survey-browser-1section.png
Example Section Validated - 3 Item buttons, 1 question answered, 1 mandatory question unanswered
../../_images/survey-browser-1section-validated.png
Android:
not yet available
iOS:
not yet available