Data types

August 9, 2018

Survey Solutions uses C# language for enabling and validation conditions. C# is a contemporary general purpose object-oriented programming language, widely documented. When writing expressions in C# language, and especially when using standard C# and custom Survey Solutions functions it is important to keep in mind the definitions of the various Survey Solutions objects.

Below the types of Survey Solutions objects are explained in terms of standard C# classes and types. Links are provided to the corresponding definitions on Microsoft’s site.

Note that in the definitions below a question mark indicates a nullable type.

 

Questions

 

Question Type
Categorical: Single-select int?
Categorical: Single-select (linked) int[]
Categorical: Single-select (linked to text-list question) int?
Categorical: Single-select (combo) int?
Categorical: Single-select (cascade) int?
Categorical: multi-select int[]
Categorical: multi-select (Y/N mode) class {
  int[] All;
  int[] Yes;
  int[] No;
  int[] Missing;
}
Categorical: multi-select (linked) int[][]
Categorical: multi-select (linked to text-list question) int[]
Numeric double?
Numeric (integer) long?
Date DateTime?
Date (current time) DateTime?
Text string
Text (with pattern) string
Barcode string
Picture string
List Array of class{int Value; string Text;}
GPS class {
  doubleLatitude;
  doubleLongitude;
  doubleAccuracy;
  doubleAltitude;
}
Geography class {
  double Area;
  double Length;
  int PointsCount;
}
Audio class {
  string FileName;
  TimeSpan Length;
}

Notes:

  • The value of the categorical multi-select question can be null, or an array of length zero.
  • The string content of the picture question is the name of the file, not the content of the image.
  • The value of the categorical multi-select linked question is defined as a jagged array although in practice it is always a regular-sized array.

 

System variables

 

Variable Type
@rowcode int
@rowindex int
@rowname string
@optioncode int
@roster
[obsolete, refer to a roster by ID instead]
IEnumerable<class>, class[]
@current class

Notes

  • In definition of @current object is a dynamically compiled class definition with all the fields defined as for an instance of the roster.
  • Correspondingly any roster is an IEnumerableenumeration of objects of this class, also supports addressing by index as an array.

 

User-defined variables

 

Variable (selected type) Actual type (in expressions)
Boolean bool?
Double double?
Date/Time DateTime?
Long integer long?
String string

 

Lookup tables

Lookup tables are defined as dictionaries:
Dictionary<int, class>
where class is a dynamically compiled definition containing rowcode and all the fields present in a lookup table:
class {
  int rowcode;
  double? field1;
  double? field2;
  ….
}

These definitions have last been updated for version 5.25 on Feb 07, 2018.