Equivalent of TONUMBER in CBAS?

In N1QL, I can use the TONUMBER function to return a number from a string. In CBAS with SQL++, is there an equivalent? (I don’t see TONUMBER on the SQL++ Function Reference) I have fields of the form “+18029412” that represent a number I would like to sort documents by (numerically).

Hi Matthew,

For now, you can use:
-- bigint(..), if you know all the numbers are integers;
-- double(..) otherwise.

For example:
– bigint("+18029412") returns 18029412
– double("+18029412") returns 1.8029412E7

Eventually, the analytics service will support the TONUMBER function as well.


1 Like