Hello,
I would like to perform a sanity check for some input data which represent numbers that are using the comma as the decimal separator. I stumbled on the message “[FORG0001] Cannot convert to xs:double: …” then according to the evaluation of another XQuery script by the software “BaseX 9.7”. https://docs.basex.org/wiki/XQuery_Errors#Functions_Errors
Can any functions help with the safe handling of currency values for my use case? https://docs.basex.org/wiki/Conversion_Module
Regards, Markus
On 21.04.2022 09:20, Markus Elfring wrote:
I would like to perform a sanity check for some input data which represent numbers that are using the comma as the decimal separator. I stumbled on the message “[FORG0001] Cannot convert to xs:double: …”
Depending on the format of the numeric data it might suffice to use e.g.
. => translate(',$', '.') => xs:decimal()
to remove e.g. a $ symbol/currency symbol, to replace the comma with a dot and then to convert the numerical string to an xs:decimal value.
basex-talk@mailman.uni-konstanz.de