How to change the name of a view, when opened by certain action or from a certain view?

Hy,

I am having some trouble getting the right Form to be opened by the right Action Button. They’re tricky to explain but I guess an easy solution is if there is a formula to put in the Display field of the Form View, to tell it that, if it is opened by a “Certain button”, it would have “A name” and if opened by “Another button” it would have “Another name”.

Is there such a formula?

Or it could also be - if previous view was “This view” than the for would have “This name” and if opened from “another view”, it would have “Another name”.

Thank you,
Sorin

0 11 2,780
  • UX
11 REPLIES 11

Hey Sorin.

In order to make this functionality what I’ve done is include a column in the table to hold a variable that you can then use for programming and such.

I call it Form_Type, make it a text and hide it; I’ll pick some keywords and add them into the LINKTOFORM() actions, then use show if’s etc. to configure things.

On the Save action of the form, I’ve got another action to clear the Form_Type column, this way it’s always blank; you could leave this part out, if you always open the form via a custom action, but if you edit the action by the system generated action, the Form_Type will be whatever it was last time - this is why I’ve taken to making a clear action to fire off at the save.

Hope it help!!!

@MultiTech_Visions Thank you, I really got some ideas out of it but not related to my issue really, your explanation is a bit over my head. But I think I’m good for now.

Just to explain if others read into this post:

The issue is that I make a Projects Table and add it to Appsheet.
Then I get an automated Project_Form View and in Actions, I get an Add and an Edit automated actions (and others but these two make the point here).

The thing is that both Actions access the same form. And I use the Display View Title up on the menu bar option, so Users (me included :)) ) know where they are. So I guess you guessed it by now, the perfectionist in me wants to have the Title Display “Add new Project” when you get to the form by hitting the Add Action, and “Edit Project” when you get to the form by hitting the Edit Action…but since both actions go to the same view, you get one name.

Now I think I might also have some bugs on the app (or maybe I didn’t work cleanly enough) because I made new views and new action buttons with linktoview links between them, but I’m having trouble making them work (some do some don’t … some work but have the button appear on a different page for some reason … I’m not figuring out a rule there to be able to explain it … even as a bug) so for now, my solution is:

I named the form Add/Edit Project :)))
and that’s good enough for now. I’ll address it again when I’ll have more Appsheet experience.

Thanks Matt

You might be able to figure out a hack using a ChangeCounter column

Try:

IF(
  ISBLANK(
    FILTER(
      "Projects",
      ([Project Name] = [_THISROW].[Project Name])
    )
  ),
  "Add",
  "Edit"
)

replacing Project Name with the correct name of the Projects table’s key column if I remembered it incorrectly.

Here, we’re exploiting the fact that FILTER() (also LOOKUP(), MAXROW(), MINROW(), and SELECT()) scans the actual table, ignoring the copy of the row in the form. A row in the form for adding doesn’t yet exist in the table, so if we look at the table, we won’t find it. If we don’t find the row of the form in the table, a new row is being added. If the row of the form does exist in the table, an existing row is being edited.

This same approach can be used to compare a column value in a form with the value in the saved copy of the row.

Hack hack hack, all day long. Hack hack hack while I sing thing song.

Hy @Steve,

Where would this formula go?

The Display name expression. We were talking about display names, right?

The display Name of the Form. So here right?

Yes.

Hi @Steve When I try your expression I get this Error Message:
Error in expression '[_THISUSER].[Key]' : Unable to find column 'Key'
Sot it changes [_THISROW] to [_THISUSER].

I am wondering if [_THISROW] is available in the Display Name expression, because it says:
This formula is not evaluated in the context of a row, so column values are not available.

Maybe this is related to this post?

Argh! Yes, _THISROW is not available in display names! I recall now that when I use this formula, it’s as part of a Show column that I use as a view title, not as a page display name. Sorry for the confusion and false hope!

Top Labels in this Space