Data types

August 9, 2016

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

 

QuestionType
Categorical: Single-selectint?
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-selectint[]
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[]
Numericdouble?
Numeric (integer)long?
DateDateTime?
Date (current time)DateTime?
Textstring
Text (with pattern)string
Barcodestring
Picturestring
ListArray of class{int Value; string Text;}
GPSclass {
  doubleLatitude;
  doubleLongitude;
  doubleAccuracy;
  doubleAltitude;
}
Geographyclass {
  double Area;
  double Length;
  int PointsCount;
}
Audioclass {
  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

 

VariableType
@rowcodeint
@rowindexint
@rownamestring
@optioncodeint
@roster
[obsolete, refer to a roster by ID instead]
IEnumerable<class>, class[]
@currentclass

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)
Booleanbool?
Doubledouble?
Date/TimeDateTime?
Long integerlong?
Stringstring

 

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.