How to detect a row is a newly inserted row

Current solution is

  • add a virtual column name TempKey which is set identical to a table’s key named _Key. Set the column as a reference column which will point back to the current table
  • add another virtual column named isNew in which we check the TempKey reference. E.g ISBLANK([TempKey].[_Key]). If the column is true, the current row is brand new.

Is there better way to detect the newly-inserted row? What’s your trick?
Thanks in advance for sharing.

Note - we use the information to make some columns editable at the insertion state or at re-editing state.

To use in a form to determine if the row is new:

IN([_ROWNUMBER], table-name[_ROWNUMBER])

Or:

1 Like

I thought about using filter or checking row number list but could they be slower?

Honestly, I don’t know the performance impact of using a virtual column.

Depending on what sort of expression you kick into Virtual Column, but IN() expression is one of heavy expression.
If you use with small amount of data set, no obvious impact (slownesss) you may feel, but once the data set grows, it will slow down the app.

After IN expression, Select expression is generally expensive as well.

1 Like

The virtual column is simple duplication of the key. Say _ComputedKey is the key. Then the virtual column will have the formula [_ComputedKey] and then reference back to the same table.

Sounds like a self-ref type of arrangement, it should not be a heavy operation then.

@Steven_Aung Why would you need to have a virtual column for this purpose at all? If you use the IN() expression with the Editable If, it has nothing to do with performance because it’s recalculated only when you edit the record.

3 Likes

I see. The reason was that the editable calculation is shared by multiple columns.

It doesn’t matter if one or more columns are involved. You just need to create a suitable formula for your Editable option.

1 Like

Good to know that.

1 Like