Feature or Bug: Field value pre-set

There are two Date/Time columns in a table for the beginning and end of a task.
Also there is a column for the duration of the task in minutes (Math column).

When adding a new task beginning and end are of course empty.
But the duration (“Dauer in Minuten”) is set to 75 :astonished:

Bildschirmfoto 2023-07-16 um 18.04.07

Where is this value coming from? Incidentally it’s the first value ever calculated for a duration after adding the column.

The value does not change after entering the dates even though it’s a Math column:

Bildschirmfoto 2023-07-16 um 18.04.32

But once the task is submitted/added and I open the edit screen with components layouted the same as on the add screen, the duration shows up correctly:

Bildschirmfoto 2023-07-16 um 18.04.56

Very strange behavior. Any explanation, any remedy? It’s looking like a bug.

Is this all happening inside a native form?

My suspicion would be that you are seeing the result of the calculation in the first row of your target table.

One thing to be aware of is that it’s not possible to show the results of computed columns inside native forms (if the computations use the values to be submitted). This is because form data is held in memory and only written to the underlying table after the form is submitted.

To be able to show real time calculations inside forms, you need to use Custom Forms.

Yes, it’s a “native form”. Created form the Tasks table.

I thought the same: it’s not possible to do math until the values are submitted to the record in the table. That would be ok - but then I’d expect to see “0” or “NaN” (which I did for a while but now it’s gone).

Indeed the value is the one from the first row in the table. How come? :thinking:

But never mind, I guess I either remove the field on the add screen. Or try out a custom screen.

Thx for your help!

I think @Jeff_Hager has a better understanding of this behaviour than I do, so I might defer to him on this one.

1 Like

@Ralf_Westphal As mentioned, computed columns do not work inside a form. Data has not been written to the table yet for those calculations to occur.

As for the value displayed, If it’s a form container on a screen, or a button that opens a form on a screen, and that parent screen is not filtered in any way, then the screen is naturally going to attach to the first row in that table. If there was a filter applied to the screen that contains the form container or form button, then the duration seen inside the form would be most likely be different. It’s basically taking values from the parent row. Being that the screen’s source table for the form container/button and the destination table for form are the same table, then it’s confusing because you see the same columns.

Try adding a similar form container/button to a screen that is attached to a different table that is not the Task table, but still set the destination of the form as the Task table. Now when you try to add a fields or text component to show your calculated value, you won’t even have access to that column, because the parent table is completely different.