Hide a column on a new entry

hi, i’m looking for a way to hide a specific column only on a new entry form.

I have a client’s table with 4 columns : key, A, B, C
[key] is auto generated.
what I would like to do, is when I create a new client, the form ask me to complete only column A an B and doesn’t show column C.
But when I look at my client details or when I edit the client, I want to see all 3 columns A, B, C

I tried those “show if” expressions but it doesn’t work :

that work with this one “contains(clients[key],[key])” but it’s heavy to search in the whole table

To Hide the column (field) from Form View, Inside the show_if condition of that particular field, you can use

(CONTEXT(“ViewType”) <> “form”)

This will not show the field when adding the new record but the problem is that it wont show even when editing the record coz editing record uses the form type view too.

Another Option would be to use LOOKUP, So it looks up the clients table for the KEY you are working on, if it exists which means you are editing the record, if not then the KEY is new and not in the table yet and so wont show the field. But not sure, it might show the field until the form generates the KEY ( assuming you have automatic key generation setup) which is usually a fraction of second and then disappear.

1 Like

what is the more efficient between lookup() and contains() ?

Is there no way to differentiate new row form and editing form ?

I have never tried Contains() , So not quite sure.

Please try in the show_if of column C

IN([Key], Table Name[Key])

1 Like

For reference:

1 Like

I tried those 3 and they works.

My real purpose is to find the more efficient way to do it.
I have a lot of datas in my app and it start to become slow to use, slow to sync (min 30seconds), so I update my app, i change my expressions to find the lightest way for it to work.

Is an expression like lookup, in, contains … that need to find a match inside 20 000 rows can slow my app ?

Got it Thank you. Yes, you had lightly mentioned your real purpose. Sorry that we missed it out.

I would do it as follows. Maybe there is a better way. The approach requires another real column though, so you may need to weigh in options.

Add a real column , text type called say [AddEdit] with an initial value of “Not Added” . The column needs to be hidden.
Add an event action on form save to set this column [AddEdit] to “Added”

In the column C’s Show_if constraint, please add expression [AddEdit]=“Added”

Edit: Alternatively if you run this event action through a workflow on “Adds only” event, the action will run only once when the row is getting added, instead of running it on each form save during edits of the same row. Even though end result will be same if the action is run through form save or workflow.

1 Like

Thanks, I’ll try that.
It seems to be a good solution.

1 Like

Great. Will appreciate if you post back with your observations on how it works, so that it can be useful to any future readers of this thread.