EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB220227: New feature in MicroStrategy Mobile app 9.4.1 iOS Update 5: Input Validation for Survey Widgets.


Community Admin

• Strategy


This document discusses the new feature Input Validation for Survey Widgets.

The Input Validation feature controls what values the user can enter into the different questions of the Survey Widget.
 
The text in the respondents’ answers can be checked to ensure that they meet certain criteria, such as ensuring that phone numbers follow a specific format. To check an answer, a regular expression will be used, which searches for and matches patterns in the text.
For an introduction to Regular Expressions, see the following W3Schools reference: http://www.w3schools.com/jsref/jsref_obj_regexp.asp.
 
To check the text in the survey’s answers, in addition to the information required to create a survey with simple questions, a Restriction column must be created in the Survey table, at the question level. 
For survey answers that are text fields or text areas, the Restriction object defines the expected format of the answer. Some examples of regular expressions are as follows:

  • To require that phone numbers use the format 123-123-1234, use the expression \d{3}-\d{3}-\d{4}.
  • To require that respondents answer the question with only A, B, or C, use the expression (A|B|C).

 
At runtime, if the Current Answer of this specific question matches the regular expression specified under Restriction, the input validation passes, otherwise, a specific error message will show up. So far the input validation only applies to question type text field/text area.
 
In order to take advantage of this new functionality, follow the steps below:

  • Modify the Survey table in the database and add a new column called Restriction.
  • Add a restriction statement to the questions whose answers need to have a specific format.
    In the screenshot below, the restriction statement for Question ID 1 has been defined as follows:
     
ka04W000001MKp9QAG_0EM440000002A1P.jpeg
  • The regular expression [a-z] means that the answer for Question ID 1 can only contain lower case letters.
  • Update the Survey table in Strategy through the Warehouse Catalog.
  • Create an attribute based on the Restriction column and update Schema.
  • Create a report Survey with all the Survey attributes needed including the one created in the previous step.
  • Create a freeform SQL transaction report that will insert the answers into the Response table.
  • In Strategy Web, create a Report Services document with report Survey as the dataset. Drag the dataset into the document.
  • Right click on the grid and go to “Properties and formatting” . Go to”Grid”, uncheck “Enable incremental fetch in grid” and apply it. Then go to “Widget” and set as DHTML-Survey.
  • Go to Widget Advanced Properties and map the survey elements to the dataset attributes.
  • Right click on the grid and go to “Configure Transaction”.
  • Select the transaction report and map the transaction inputs to the grid objects.
  • Create an action selector button to submit the transaction.
  • Save the document and run from the Mobile device. As shown below, a message will appear if the answer's format is different from what was specified in the Restriction column: [0-9]{3}
ka04W000001MKp9QAG_0EM440000002A1d.jpeg

 
Refer to the Strategy Dashboards and Widgets Creation guide for further instructions about creating Survey Widgets.
The Strategy Internal Reference Number for the feature described in this technical note is 952467.


Comment

0 comments

Details

Knowledge Article

Published:

April 6, 2017

Last Updated:

April 6, 2017