A common problem developers run into is the java error where a value cannot be converted (or coerced) from a number into a string or a string into a number. While the problem can easily be addressed, It is often difficult to find and even harder to understand. So, let's review the issue and shed some light.
Cannot convert 12A45 of type class java.lang.String to class java.lang.Long
There are some Qilan operators that require the same value type in order to accurately determine a result. Operators such as >, <, ≥ and ≤ are comparison operators that can only function properly if what is being compared is of the same type. Consider the following: 2 > 100. Objectively, the answer here is NO, two is not greater than on hundred. However, this is true only if we are comparing numbers. If we assume both values are strings, the answer is YES. If one parameter is a a string and the other a number, java will return an error as the values are ambiguous with relation to one another.
In the example shown above, if 'data' is not a number, java will return an error. However this can be corrected by coercing the field value to a number.
Values submitted or obtained from a web submission are always considered as strings. Values such as ABC, 123, A1B2C3 are all strings when evaluated from a web submission, meaning the framework field that carries the value.
A number is construed as digits, with or without a decimal, when retrieved from a database table, or strings manipulated with Qilan abacus operators where the result is a number. Strings such as 10.12.2012 and 34 778,00 are not numbers.
To convert a string to a number, you must use a case operator: integer [ ], float [ ], round [ ], add [ ] [ ], etc. or any other operator where the result will be a number.
To convert a number to a string, use text [ ], [ ] followedby [ ], substring [ ], etc. or any other operator that returns a string.