Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero Values in Sources/Queries force datatype of column to text resulting in column sorting problems #9393

Closed
1 task done
SufiSR opened this issue Jan 20, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@SufiSR
Copy link

SufiSR commented Jan 20, 2023

Checklist

  • I have searched budibase discussions and github issues to check if my issue already exists

Hosting

  • Self
    • Method: Docker Single Image
    • Budibase Version: 2.1.4.2

Describe the bug
When working with Queries as Sources (in my case MYSQL) apparently an autodiscovery of the field types is made based on the first result of the query.

  • If a column in the first result row contains a 0 value the whole column in the schema is considered as TEXT. This makes it impossible to sort the column from high to low for users in tables in frontend (even though other result rows may have numbers in that column)
  • The Schema Tab under results pretends to offer the option to change the data type for any column, however changing the datatype will not be saved (no error message either)

CURRENT Workaround If you change the query with an order by so that the first result row does not contain 0 but another number, the same column will be considered as NUMBER in the schema and this will then eventually allow for proper sorting

To Reproduce
Steps to reproduce the behavior:

  1. In Sources create a query that will deliver a 0 in a column as the first result row (e.g.: SELECT "myname" as MyName, 0 as Thisshouldbeanumber,"" as thisshouldbetext)
  2. Run the Query
  3. Scroll down to Results and look at the JSON Tab - you will see Thisshouldbeanumber: "0" <-- interpreted as TEXT
  4. Switch Tabs to Schema and you will see Key Thisshouldbeanumber : TEXT

Expected behavior
Alternative a) 0 are interpreted as a number instead of text
Alternative b) Changes to the schema under results will allow for saving and explicitly setting a column to a specific datatype

Screenshots
image
image

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome
  • Version 109.0.5414.75

Other Notes
This is my first issue report. Feel free to change the wording and headline as needed :)

@SufiSR SufiSR added the bug Something isn't working label Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants