Wappler Version : 4.12
Operating System : Mac
Server Model: Node
Database Type: Postgres
Hosting Type: Docker local
Expected behavior
What do you think should happen?
Create a DB Query SC that outputs numbered data, in this case i'm using 'Aggregate' in the DB and 'sum' is the SUM Aggregate and 'count' is a COUNT aggregate.
The original field type for 'sum' in the DB is decimal. The naming 'sum' is an alias of the real field name.
I should then be able to use the AC Data picker to format that number (e.g. removing decimal places for the UI).
Actual behavior
What actually happens?
Data Picker views the number output as an 'A' and therefore only gives me text formatting.
See query output in AC:
Both here should actually appear as a number.
However when I click on the number field 'sum' and use the magic wand:
So are there any errors in the console?
What value do you see when you run the server action directly in the browser - most probably it just returns a string and that's why you don't see the numeric formatters for it. So when you try to apply them, you probably see "Not a number" warning in the console.
So, what is going on here? The DB Field is a decimal, i’m using the ‘SUM’ aggregator - and in the AC Data Picker it initially shows this field as a number - then when I go to use the formatter - it believes it’s a string?
Is this expected behaviour, even though the field in the DB itself starts off as a decimal type? I would have assumed if the DB field is a type of number that the formatters should see it as such?
Just for my information.
If you don’t see this as a bug, feel free to unlist.
Yes it is the expected behavior. The decimal values do not fit the JavaScript number type so it becomes a string.
You need to convert them to number if you want to apply numeric formatters to them or do any calculations.