Hi,
Is there any way to convert a varchar to a float in a Domain's calculated field. I am pulling data from a MSSQL database.
Thanks,
Dennis
1 Answer:
Posted on March 8, 2017 at 1:03am
Hi,
you can specify your custom function in WEB-INF\applicationContext-semanticLayer.xml to convert varchar to float.
There is str2int function already defined in the file, within "sqlserverGenerator" bean:
<entry key="str2int">
<value>"cast(" + sqlArgs[0] + " as numeric(10,0))"</value>
</entry>
You can add your custom one like
<entry key="str2float">
<value>"cast(" + sqlArgs[0] + " as float)"</value>
</entry>
then restart the server and use str2float() function in Domain Calculated field
Best regards,
Andrew