Is there a way to dynamically change the type of a column?

Hi, I’ve got a feature that I want to add to my client’s app and I’m wondering if there’s a smart way to do it.

The app is part of a factory workflow, and every time a factory worker starts or ends a new batch, they need to fill out a number of maintenance fields. Sounds straightforward enough - however, my client would like to be able to edit the fields in the app itself - so they need to be dynamic.

I have another part of the app like this for leftover materials, but that’s more straightforward because the fields for the material entries are always the same - text name of material, decimal amount of material.
I handle it by having the materials table “belong” to the batch table, and just generating x rows in leftovers (based on another table called Material Types) related to the batch which can be edited in the batch.

However, the maintenance part is more complicated because the questions could be text, number or yes/no (maybe more things). What I want this to be is a simple table with “Maintenance Item” and “Value”, and the user fills in Value, but the Value is not necessarily always the same type.

One idea I had to get around this was to have three different columns for potential values in the maintenance table and only showing one of them depending on the type, but A) this is going to be an inline table so it will not display properly if I do that, and B) it will probably make something else break later.

Alternatively - is there a way to add/remove/edit COLUMNS themselves from an app? That would be even better, as I wouldn’t have to break up the form with inline tables.

Thanks,
Alex

Changing the column type dynamically is not possible. How about if you use Enum field with fixed values like Yes and No. If you set the option “Allow other values” as ON, you are able to write text, number, decimal etc. If you need to use number somehow in another place in your app, you can then convert it to a number like NUMBER([EnumColumn]) or DECIMAL()

4 Likes

I’ve been tracking may daily activities for several years with an app structured this way.

You could create a virtual column that populates with the textual representation of whichever column contains a value and include this virtual column in the inline table rather than the typed columns.

2 Likes

virtual column

oh Steve you’re a legend, this is the solution, thanks

1 Like