Blog Post created by TMACUL Champion on Jan 1, 2016

Data Type Conversion


From SDU

Jump to: navigation, search


To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.



This This article details how to convert from one data type to another in Spel code. This concept is regarded as casting.


Primary data types used in USD spell.

  • string
  • int
  • float
  • date
  • duration
  • bool
  • uuid (introduced in r11.x)
  • object


string MyString; int MyInt; 

float MyFloat; date MyDate;

duration MyDuration; uuid MyUUID; 

MyString = "Hello world no: " +(string) 1; // result: "Hello world no: 1"

MyInt = (int) "2 times")// result: 2

MyFloat = (float)MyInt; // result: 2.00000

MyDate = (date)( (string) now()); // result: the actual date depending of your system time configuration

MyDuration = (duration)((int) "2" + 3), // result: duration of 5 sec.

MyUUID = (uuid)expand( "&{'mylogin'=cnt.userid->id}"); // result: the id of contact having userid "mylogin"


In Spell code you can use arrays as well.

Accessing array fields is very similar to other languages, simply use


to access forth element of an array myArray. Arrays are 0-based.

Here is the example of declarantion of a new array of strings with 4 elements:

string msgs[4];

Retrieved from ""