dglasberg Posted March 15, 2017 Share Posted March 15, 2017 Hi,I am trying to convert a varchar column in a MSSQL database to a BigDecimal field via a Domain calculated field.When i bring this calculated field into an Ad Hoc view I get the following error:2017-03-15 10:33:49,773 ERROR AdhocAjaxController,http-apr-8080-exec-6:954 - ad hoc controller exception: An error occurred while performing the previous request.org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '5500.0000' with class 'java.lang.String' to class 'java.math.BigDecimal'. 5500.00 is the correct amount returned by the database.The forumla I have in the calculated field is:str2money(CA_SE_Log.New_Data)I have a custom str2money function that converts the varchar to money via SQL:<entry key="str2money"> <value>"CASE WHEN ISNUMERIC(" + sqlArgs[0] + ") = 1 THEN CAST(CONVERT(money, " + sqlArgs[0] + ") AS DECIMAL(34,4)) ELSE (0.00) END"</value></entry> Thanks,Dennis Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now