Add functions for converting between data types in AF Analysis Expressions
If you have an analysis input that is the "string" data type but can be represented as a number (for example, the string "2.35"), then to convert this string into a numeric data type such as double it is necessary to take the string and output it to another attribute that has the correct data type. There are no usable data type conversion functions in AF Analytics, so it is not possible to take the string, convert it into a double, and then store it in an analysis variable to be used again in the same analysis. It is possible to take a string input and output it to an attribute of the correct data type to make the built-in automatic conversion happen, but this means users will end up with an unnecessary attribute every time they need to do a conversion.
It would be better if there was a way to convert data types (at least strings to numbers) directly inside of AF Analysis Expressions without having to rely on the automatic conversion that happens when you output the result to an attribute of the desired data type.
Brent Bregenzer commented
Hi, Evan. Would the functions Float() and Int() suit your purposes. You can wrap a string in either to convert to numeric type (see attachment).
Can you tell me where these strings are coming from? Are they from some data source, such as a PI Interface or PI Connector?