Data Type Conversion
From SDU
Revision as of 14:17, 30 June 2008 by Gityerfix (Talk | contribs) (New page: This This article details how to convert from one data type to another in Spel code. This concept is regarded as ''casting''. <br> --<small>Article provided by [[User:Nero Le Velu|Nero Le ...)
This This article details how to convert from one data type to another in Spel code. This concept is regarded as casting.
--Article provided by Nero Le Velu.
Primary data types used in USD spel.
- string
- int
- date
- duration
- uuid (introduced in r11.x)
Example:
<source lang="javascript">string MyString;
int MyInt;
date MyDate;
duration MyDuration;
uuid MyUUID;
MyString = "Hello world no: " +(string) 1; // result: "Hello world no: 1" MyInt = (int) "2 times"); // result: 2 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"</source>
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.
To discuss or ask questions about this article, select the discussion tab above.