Behaviour - Run Action based on a value in the form

Hello everyone,

I have a form that I use to update the current user of a device based on the serial number that was selected in the form. What I am trying to do is update the name of the person that received the equipment based on what was the type of the document selected in the form.

DocType is Enum type, has 2 values - Received & Returned

I tried something like this in the "Update Owner" action, but the issue is that DocType is "LIST" type and "Received"/"Returned" are Text and I can't compare List with Text. It's pretty simple, but I think I'm missing something.

Full Name =

IF DocType = "Received" THEN Owner = Owner from the form

ELSE (having only 2 options, if it's not 1st it has to be 2nd one) Owner = ""

What I have:

Show More
Update Owner Name ActionRazvan_0-1654692484276.png

The behaviour itself works, but it updates the owner no matter what I select in DocType.

Any ideas? I'm kinda stuck.

Thanks,

Razvan

0 5 408
5 REPLIES 5

Update - I think I fixed it  - IF(ANY(SELECT(Proces Verbal[DocType],[_RowNumber] = MAX(Proces Verbal[_RowNumber]))) = "Predare - Primire",ANY(SELECT(Proces Verbal[Full Name],[_RowNumber] = MAX(Proces Verbal[_RowNumber]))),"") --- I added the same formula that I used to get the name, to check for DocType.

I'm still curious what other possibilities are out there.

It is difficult to understand your setup and what do you want to achieve. Please show screenshots of the columns in your tables from the editor and the relations among them. 

so, this is my form table - 

and this is my Devices Data table

 

 

 

I want the app to check if the form is a Receive or Return form and then run the action. If the user receives a device, I want that user to appear in the devices table, if the user returns a device, I want the name to dissapear from the devices table. All this is based on the data that was submitted using the Proces Verbal form.

IF ( DocType = "Predare-Primire'
  THEN run the action to update name with last form submission value
ELSE run the action to update the name to a blank value )

Since DocType only has 2 values - Predare-Primire (also named Receive in this message) and Retur (also named Return in this message) - the ELSE should update the name to a blank value. 

Let me know if you still need more info.

Thanks!

Inside an automation bot, you can include branching based on conditions to execute one set of actions or another. Also inside the behavior actions you set conditions so that action can only be triggered if the condition is fulfilled. 

Please start by reading these guides, follow the links inside and tell us should you face difficulties:

Hi @Razvan,

This sounds like a great AppSheet App!

I think another useful feature for showing and hiding certain records is with Slices. 

Slices are great for filtering certain records based on a condition like [DocType]="Received". Once the slice is made you can then create a view that only shows Received records, i.e. Received Table (Slice), and a view that shows either all records or Returned records. 

Also, if you are looking for more ways to learn best practices for building on AppSheet, I highly recommend our Training Platform AppSheet Training. We have training content from database design to building advanced expressions. Find out more here: AppSheet Training

If you would like to set up a time to meet and discuss your app with our team you can schedule a time here: Tech Talk

Thanks,

Austin from AppSheet Training

Top Labels in this Space