How to allow editable field in table to accept numbers in a text field?

  • Goal: I have data in BigQuery, and I have an app in Retool with a couple editable tables. I have a few columns in the tables that are "text" fields using type "Tag", however there are some values that are numerical (ie. like a model# "245" or "-2")

  • Steps: Created the table populated by a SQL query, and created a query to do a bulk update. That all works perfectly. The SubModel field is Text but I have entries that could be -2, etc. So, when I attempt to update that field I get an error saying that I am trying to update a text field with a number.

  • Screenshots:

Thank you all in advance

Hi @Dane_Bodamer,

You should be able to CAST your value as a STRING. Something like this:

INSERT INTO your_table (your_column)
VALUES (CAST({{ component.value }} AS STRING));

You can also use SAFE_CAST instead of CAST, it just returns null if the value can't be cast.

Hey Mike, thanks ! So, let me add more context. apologies as I wasn't complete.

Using a Resource Query to do the update via GUI model.

I call it via the Save Event Handler in a Table with an editable field

However, the CAST tip will definitely work in other areas, so thank you !!

Hi @Dane_Bodamer, welcome to the forum! :wave:

If we can't directly use the data from activeTable.changesetArray we should create a JS Transformer (a JS query would also work and I have a personal preference for these) where we can map over the change set, use parseInt where needed, and return the new array. On the bulk update query, pass the data of the Transformer (or query) instead of the changeset array.