Help Needed with Custom Query Numeric Values and Formatter

Hi Wappler Community,

I'm encountering an issue with a Custom Query in a Server Connect that returns numeric values, but I'm having trouble displaying them properly on my page.

  1. Problem with Array Recognition:
    When I insert the Server Connect into the page, Wappler doesn't recognize the result of the query as an array (see Screenshot 1). This seems to be the first problem.
    Screenshot 2024-10-01 alle 18.52.03

  2. Values Displayed as Text:
    I created a table to display the values returned by the Custom Query, but Wappler treats these values as text instead of numbers (see Screenshot 2).
    Screenshot 2024-10-01 alle 18.52.09

  3. Formatter Issue:
    I tried changing the Type from "Text" to "Number" and adding a formatter to handle the values correctly (see Screenshot 3), but once I confirm the changes, the numbers disappear from the table.

Screenshot 2024-10-01 alle 18.53.31

Could someone please help me resolve this? I'm unsure why the values are being misinterpreted, and how I can ensure they are treated and displayed as numbers.

Thanks in advance for your support!

Roberto

Screenshot 2, please show everything that comes before... If you cut your screenshot like that we don't have enough information to help you :man_mechanic:

1 Like

Hey Robert

I suppose you talk about a numeric DECIMAL value...
It is known that decimal values are represented as text on client side.
I suppose in your case is easy to control it on serverside.
Create an ArrayList, define the 5 fields you need (set valore_medio_imu as a decimal)
Add a repeat after your custom query and loop through it.
Now disable the custom query and output the arraylist.
I'm on mobile, think I'm correct.
If you have problem ask again buddy

Hello @famousmag thank you for your hint.
I made a test and with an array, the frontend see the query as an array and values as number.
But when I apply '.formatNumber(2, '.', ',')' numbers disappears from table...
Here the movie:

screen

Hello @Apple

here the start.. with original serverconnect. When doing a Table Generator and open the Server Connect .. I got text query not array

Do you see any errors in the browser console when you preview your page in the browser?

I forgot to check !
Here the errors:

Is the formatter js included on the page?

in the content page I have:

Screenshot 2024-10-02 alle 13.02.41

only.

And on the main page is the formatter js included?

No.

<head>
  <script src="/dmxAppConnect/dmxAppConnect.js"></script>
  <base href="/">
  <meta charset="UTF-8">
  <title>Untitled Document</title>

  <link rel="stylesheet" href="/dmxAppConnect/dmxBootstrap5TableGenerator/dmxBootstrap5TableGenerator.css" />
  <script src="/dmxAppConnect/dmxBootstrap5Theme/dmxBootstrap5Theme.js" defer></script>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="stylesheet" href="/bootstrap/5/cosmo/bootstrap.min.css" />
</head>

I added it to the main page and it works. thank you.
Strange it was not added

Well that’s your issue then :slight_smile:

2 Likes

Thank you very much !!