Navigate to View based on Value Added

Hello,

Appsheet newbie. Within our app, we are adding items to a database. If the new row is a specific type, we need to we navigate to another form (after the action is saved), to enter additional data. But if the new row is a different type, the app should navigate to the existing default view.

For example:
Action: Adding New Car
Form: Car_Form

Requirement
If the ‘CarType’ = ‘Convertible’,
Then
After saving the entry, we need to go to ‘ConvertibleDetails_Form’ to enter additional
details (e.g. hard top, soft top, top color, etc.)

If the ‘CarType’ is not ‘Convertible’
go to to the ‘CarList’

Current Navigation
After a new entry is added, the system generated action is automatically taking the user to the CarList.

Question
Is there a method or expression to add navigation conditions to the system generated Save action, based on the data type (e.g. Convertible, Not Convertible)?

Thanks,

Alex

You could create show-if columns condition to only show those column if [CarType] = “Convertible”.

2 Likes

Your use case appears to be similar to form branching. Your use case may be different than described in the article below if your forms are on different tables so you may need navigation. However you may also take a look at the following help article that adds to the guidance of using Show_if constraint mentioned by @Heru

If you are looking for something else , please post back with more details of your requirement.

3 Likes

You can create an action that navigates to the desired target an attach the action as the Form Saved event action of the Car_Form form view:

1 Like

Hello,

Unfortunately, the article was not applicable to our specific use case.

  • In our use case, the forms are on different tables. Also in our use case, the first action is to create the new record
  • Based on the details of the record that was created, this new record may be part of a related child table
  • This related child table contains the details that the second form is based on

Using the car analogy:

Action: Adding New Car
Form: Car_Form

Requirements

  1. Save new car
  2. If the ‘CarType’ = ‘Convertible’,
    Then
    After saving the entry, we need to go to ‘ConvertibleDetails_Form’ to enter additional
    details (e.g. hard top, soft top, top color, etc.)

If the ‘CarType’ is not ‘Convertible’
go to to the ‘CarList’

Actions

  1. Create a new Car with Add Car Action (currently handled by a System Action)

  2. Add new Car to Car table

Navigational Branch Requirement
After creating the new car, as a new row in the Car Table, (this is currently is handled by the system action), the app needs conditional logic that either:

A. Sends the user to the ConvertibleDetails_Form
If the CarType is Convertible

Or

B. Sends the user to the CarList table
If the CarType is not Convertible

In other words,
The Form Saved event action, of the Car_Form form view, has to first add the new record to the database (Car table) and then use the logic to determine which form to navigate the user to (either the ConvertibleDetails_Form or the CarList Form).

1 Like

Thank you @Alex for detailed description. As mentioned by @Steve, I believe you could use LINKTOFORM() action as event action on form save of “Car-Form” to navigate to “ConvertibleDetails_Form” or 'CarList Form"

https://www.appsheet.com/samples/This-app-shows-how-to-link-to-a-form-and-fill-in-default-values?appGuidString=ad497f8e-7d8a-4664-8a4a-43c202bb6126

Edit: Article on event actions

1 Like

Hello,

There is a small piece I am missing. In the Behavior section of the form (Event Actions), I am not seeing an option or formula bar that allows me to set the conditional Navigation.

I also checked in the ‘Finish view’ option.

Alex

You could set the conditional nvaigation in the action itself. So you will have only one “on form save” event action with an expression something like

IFS([_THISROW].[Car Type]=“Convertible”, LINKTOFORM(“ConvertibleDetails_Form”, “Car Table Key”,[Car Table Referencing Column in Child Table]), [_THISROW].[Order Status]=“Not Convertible”, LINKTOFORM(“CarList Form”, “Car Table Key”,[Car Table Referencing Column in Child Table]))

You will need LINKTOFORM() if you wish to pass on some values (such as reference column needed to create parent and child record relation) from saved Car Table record to the ConvertibleDetails_Form or the CarList Form. Or else only LINKTOVIEW() would suffice.

2 Likes