How can i force the data type automatically selected when adding a new table full of data?

instead of going through everything i've tried and why i'm trying to accomplish this, i figured this might be easiest.

why, when using sql server's:

CAST(fieldThatOftenReturnsNumericValues as TEXT) as supplierItemSpec

does retool's table component insist on forcing supplierItemSpec numeric?

i love the auto-data-type-selection that happens, but i want it to select it correctly, especially if i'm explicit. is there a better way?

ftr, i've tried nvarchar, varchar, etc.

i've even done this:

CAST(fieldThatOftenReturnsNumericValues + ' ' as TEXT) as supplierItemSpec and if the records that initially populate the table are numeric only (even with the space) it auto sets to number.

of course, this will work:

CAST(fieldThatOftenReturnsNumericValues + ' -' as TEXT) as supplierItemSpec

Hey @josh2e! Thanks for reaching out.

This sounds like one of those rare times a feature turns into a hindrance. :sweat_smile: There are a few things to keep in mind when considering why this is happening. The table component:

  • knows nothing about how the backing query is written
  • only sees the specified data source, typically an array of objects
  • assumes that strings which solely contain numeric characters are meant to be integers
  • sets the initial column types based on the majority of values

I'm not sure what it might look like to solve your specific problem, but do think it's worth bringing up with the team. :+1: I'll follow up here when I have any updates!