Skip to main content

1E 23.11 (SaaS)

Interaction.ShowSurvey

Method

ShowSurvey

Module

Interaction

Library

Core

Action

Display a pop-up survey to one or more user sessions.

The pop-up includes questions text followed by a set of selectable choices, and an optional free text box.

Parameters

AllowFreeText (boolean, optional, default false): Indicates whether a text box should be included with the survey to allow input of free text comments.

If set to true and free text is supplied in the user response, then it is returned in the FreeText field.

Async (boolean): Whether to run the method synchronously or asynchronously.

In synchronous mode the method will only return once all user sessions have responded or have timed out.

In asynchronous mode, the method returns immediately and results will appear as events as user sessions respond or timeout.

Choices (string): A table of ordered choices to be displayed as part of this pop-up survey.

The table consists of rows of Text strings, and optionally a Color value. An Icon may also be optionally associated with each entry.

The Color value can be either a RGB hex code such as '#bf930f' or a color description such as 'blue'.

The Icon can be specified based on the list shown in the notes section below.

The order of the choices determines the response value that is returned when a choice is made; for details see ResponseValue below.

Description (string): Description text that will appear when the pop-up question is displayed. Max 512 characters.

FreeTextLabel (string, optional, default "Anything more you'd like to tell us?"): If AllowFreeText is true, then this can be used to set an alternative label for the free text field of the survey.

Link (string, optional): A URL which will appear as a 'Click here to find out more' link within the survey.

Name (string): Name of the survey.

This is used to uniquely identify the survey, and prevent repeat showing of the same survey.

Question (string): Question text that will be displayed as part of this survey. Max 128 characters.

ResponseValidityMinutes (integer, optional, default 0): A response validity period in minutes.

The maximum value allowed is 129600 minutes (90 days). Default is 0 which means survey maximum validity period of 90 days will apply.

Response validity is a way to avoid repeatedly presenting a user with the same survey. When a user provides an answer to a survey, the response they give is deemed to be "valid" for the duration specified here. You may then use the Interaction.GetActiveResponsesmethod to test whether there is already a valid answer for a particular user/survey; if there is, you may wish to avoid calling Interaction.ShowSurvey and instead use their existing answer.

Once the response validity period has elapsed, the response is no longer marked as valid, and will not appear in the table returned by Interaction.GetActiveResponses.

You can force the one or more responses to be invalidated for a user/survey immediately by using the Interaction.InvalidateResponse method.

TimeoutSeconds (integer, optional, default 60): The number of seconds before the survey will timeout.

Minimum value is 30 seconds, maximum value is 900 seconds.

Topic (string): In asynchronous mode, this must be supplied and is the name of the event that will be raised when a user response is obtained.

In synchronous mode this is not relevant and should not be supplied.

UserName (string, optional): Username of the session to which this survey should be directed. If Username is not supplied then the survey will be directed at all active user sessions.

Return values

FreeText (string): Free text that was supplied as part of the user response.

Response (string): Text of the selected choice.

ResponseType (string): Indicates whether the user responded or failed to respond before the survey timed out.

Values are: "dismissed", "responded", "snoozed", "timed out", "invalid".

ResponseValue (double): The value of the response chosen by the user.

The highest ordered choice (first in the table of choices) will have a response value of 1.

The lowest ordered choice (last in the table of choices) will have a response value of 0.

Those in between will be allocated a fractional value between 1 and 0 relative to their position.

For example, if the choices are: (Great, Good, Average, Poor, Terrible) then these will be scored:

Great=1.0, Good=0.75, Average=0.5, Poor=0.25, Terrible=0.

UserName (string): Username of the logon session associated with this response.

Example

@a = SELECT "Very Happy" AS Text, "green" AS Color, "far-fa-grin-squint" AS Icon
     UNION ALL
     SELECT "Happy" AS Text, "#bf930f" AS Color, "far-fa-smile" as Icon
     UNION ALL
     SELECT "Indifferent" AS Text, "blue" AS Color, "far-fa-meh" as Icon
     UNION ALL
     SELECT "Quite unhappy" AS Text, "orange" AS Color, "far-fa-frown" as Icon
     UNION ALL
     SELECT "Very Unhappy" AS Text, "red" AS Color, "far-fa-tired" as Icon;

// Synchronous survey to a single user session.
Interaction.ShowSurvey(Async:false, Choices : @a, Name:"User Experience Survey",
        Question : "How happy are you with your user experience?",
        UserName:"acme\\development", AllowFreeText: true, FreeTextLabel: "Please elaborate");

// Asynchronous survey to all user sessions on this device and include a free text box.
Interaction.ShowSurvey(Async:true, Choices : @a, Name:"User Experience Survey",
        Question : "How happy are you with your user experience?",
        AllowFreeText: true, FreeTextLabel: "Please elaborate", Topic:"MyExperienceSurvey");

Platforms

  • Windows

Notes

233276324.png

In order of appearance, these are:

far-fa-grin-squint.png

far-fa-smile.png

far-fa-meh.png

far-fa-tired.png

far-fa-frown.png

fas-fa-battery-full.png

fas-fa-battery-three-quarters.png

fas-fa-battery-half.png

fas-fa-battery-quarter.png

fas-fa-battery-empty.png

far-fa-hourglass.png

fas-fa-hourglass-start.png

fas-fa-hourglass-half.png

fas-fa-hourglass-end.png

far-fa-hourglass-o.png

fas-fa-thermometer-full.png

fas-fa-thermometer-three-quarters.png

fas-fa-thermometer-half.png

fas-fa-thermometer-quarter.png

fas-fa-thermometer-empty.png

fas-fa-thumbs-up.png

fas-fa-thumbs-down.png

fas-fa-laptop.png

fas-fa-video.png

fas-fa-headset.png

fas-fa-mouse.png

fas-fa-desktop.png

fas-fa-keyboard.png