Form View display name for add or edit

We often enable the function "Show view name in header" under UX > Brand.
This helps the user understand where he is.
In a form view it would be nice to see if you add a new row, or if you edit en existing row.
Let's say you have a customer table. You would like to see "Add customer" or "Edit customer" in the view name.

Usually you can check if you add a new row with NOT(IN([ID],ThisTable[ID]))
and if you edit an existing row with IN([ID],ThisTable[ID])

But you cannot use this expression in a form view's display name. Because you get this message: "This formula is not evaluated in the context of a row, so column values are not available."

But there is a workaround.
What you need is an extra table, for example a User Table.

  • In this table you add a new column called [Edit] with type DateTime and show_if disabled.
  • Add an action to the User Table with type "Data: set the values of some columns in this row", select the row [Edit] and the expression NOW().
    Let's call this action "User Edit"
  • Add another action to the Customers Table with type "Data: execute an action on a set of rows".
    Let's call this action "Edit Ref User"
    Referenced Table: User
    Referenced Rows: SELECT(User[ID],[UserEmail]=UserEmail())
    Referenced Action: User Edit
  • Add another action to the Customers Table that is of type "Grouped: Execute a sequence of actions".
    In this action put in 
    1. The action called Edit Ref User
    2. The system generated Edit Action
  • In the form's display name use this expression:
    IF(NOW()-ANY(SELECT(User[Edit],[UserEmail]=UserEmail()))<="000:00:01","Edit Customer","Add Customer")

Now when you click on the Edit button, the value of NOW() will be stored in the User Table and the form view opens up. Since this does not take more than 1 second, the form's view name will say "Edit Customer". 
If you add a new row, the form's view name will say "Add Customer", because the value in User[Edit] is in the past more than 1 Second.

2 2 478
  • UX
2 REPLIES 2

Why not just add a hidden column with initial value of NOW() which records the datetime the row was initially created (ie. Date Encoded]), then the Display Name expression will check if the column is greater or equal to NOW() and change the Display Name accordingly.

I think it's better than having to create new records in another table. 

@JPAlpano This would really be the easiest way. But as I wrote above, you cannot use Columns Values in a form view's display name.
So the only way is to lookup a value in another table.
My suggestion is the use of a Users Table. Each user has a row in this table. [Edit] is one column in this table. So with this method you don't create new records. You just put in the DateTime in the [Edit] column.

Top Labels in this Space