Chart cannot plot line if column name has space

Hello,

I have created a SQL PIVOT table to use for my Chart to have multiple datasets.
Some of the column names has spaces e.g. “cash advance”.
I noticed that if the column name has spaces (i.e. cash advance, Wappler is not able to plot the line.

The query has no issue.
I was able to generate an output via Query Builder:

I also have results showing via Chrome Dev Tools:

Only when I update my table, and changed the column name to remove the space (e.g. changed it to cash_advance) was Wappler able to plot the lines.

I have also tried to re-create the chart and just use a single dataset instead of multiple datasets using the column name with spaces — still the same issue.
It is working if I use a column name without a space in between (e.g. loan or cash_advance).
Is this a bug or do I need to change something somewhere to make this work?

Thank you.

Hello,
It’s never a great idea to use spaces in your database table names.
The best thing you can do is to use lowercase_underscore_pattern for naming your DB column names.

Hi @Teodor, yes that is correct. All my column names has no spaces. But this is a PIVOT TABLE. The column names are actually fields pivoted into columns.

ie.
image

Pivoted into:
image

Also, from my understanding, the results passed over to the page are already in array format. Are there any issues if the name has spaces?
image

Ah, i missed the pivot part, sorry :slight_smile:
Can you provide a link to your page, where we can check what’s wrong?

Hi @Teodor, that is not possible because the page is on my laptop and eventually be deployed to an internal server to be accessed internally.

Are there any files you need that I can get that will help you on this?

Do you see any errors in the browser console?

Nope. There are no errors actually. Everything seems to be working fine. You can also see that the query is able to return the results. Maybe there is an issue reading the array values when there spaces in the name?

image

Hi @Teodor, were you able to confirm if there is a problem with the array using spaces?
Thank you.

We are going to check this. I’ll let you know what’s wrong :slight_smile:

1 Like

Hello @Teodor, were you or the team able to check on this?
Thanks.

Well since it has already been 2 weeks and I need to make this work, I just went ahead and added a new column for an alias name in my table. On my page, I used the Underscore Data Format Transform to automatically add an “_” (underscore) to the original name and save it as the alias name. Then I have modified the PIVOT query to use this. :cry: