Function deprecated but not always

Hi all,

I have method in which I use utils.numberFormat() function but on some line I get a deprecated indicator and on other lines the function is accepted

[attachment=0]2014-12-18_0822.png[/attachment]

The value used on line 152 is a variable, the values on the lines 166,167 etc. are columns from a foundset.
Is utils.numberFormat() deprecated for variables only or is the a bug/feature?

Regards,

Peter

In older versions of Servoy the format functions could be called with either date/number or string, where in the string option they actually performed a parse. Now it is changed to what it really says: format a number or date, so only numbers or dates are accepted. So I guess in your code the compiler does not know that $numDiff is a number.

Hello Patrick,

A few lines up in the code (i forgot to capture) I do $numDiff = 0;

[attachment=0]2014-12-18_0952.png[/attachment]

Regards,

Peter

This

var test = 0;
var testFormatted = utils.numberFormat(test, "####");

doesn’t give me any warnings, so somehow in your code you do something that let’s the “compiler” think it’s not a number.

My guess is that you use the same variable ‘$numDiff’ for the result which is a string, so the “compiler” thinks at that time $numDiff is a string and gives the warning.

yes Jeroen is right, you have to be aware that the result of numberFormat is always String!

Servoy warns you, that you change from Number to String.

Will investigate where it’s turned into a string.

Thanks for replying,

Peter

Here your change into a string!

[attachment=0]Schermafbeelding 2014-12-18 om 11.48.22.png[/attachment]

:)

Schermafbeelding 2014-12-18 om 11.48.22.png

Harjo:
Here your change into a string!

Hi Harjo,

I don’t think so, the columns used are defined like so
[attachment=0]2014-12-18_1155.png[/attachment]
and before running the for loop I do $numDiff=0 :shock:, but I’m still investigating.

Regards,
Peter

2014-12-18_1155.png

The result of numberFormat is always string!!

Harjo:
The result of numberFormat is always string!!

The " :oops: the quarter is now pas falling :wink: "

Thanks Patrick, Jeroen, Harjo (sorry for wasting your time on this non-issue)

topic can be closed.

Regards,

Peter