Return value of one column based off the value of another column

I have a appsheet database and Column 1 is called Task and it is a enum list, The user selects this in a form and a time stamp is generated and a timer starts when they hit save after filling out the form. There is a current jobs view which they can select the job and stop timer when they are down with the task and then a time stamp is added to a Stop Time Column, and then a Duration column does the math from the Start Timer Column and the End Timer Column and then I have a Time column that converts that duration to seconds. I have multiple columns that are labeled as the same as the options in the Tasks column, So Printing, Breakdown, IT, etc... What I want to do is have the Printing column auto fill by looking at column 1 (TASK) and seeing if it says Printing, then take the completion time from the Time column and put it in the Printing column. 

I have tried multiple expressions, But i am not sure what I am doing wrong or even if there is a better way to do it to get the same result. Pretty new to appsheet.  

Solved Solved
0 5 2,209
1 ACCEPTED SOLUTION

Not sure if I understand your question. A screenshot of your data table and current code would help a lot. Based on:


@Tmusky wrote:

What I want to do is have the Printing column auto fill by looking at column 1 (TASK) and seeing if it says Printing, then take the completion time from the Time column and put it in the Printing column.


I would say the bellow code would fulfill your request. Put it in the "App Formula" field in the Printing column.

 

IF([TASK] = "Printing", [Time], "")

 

If the TASK column has the "Printing" value, then this column value will be the same as the TIME column. Otherwise, it will be blank. You could do the same for all other columns, just changing the text comparison and time column. Take a look at:

IF() - AppSheet Help 

Define App formulas and Initial values - AppSheet Help 

 

View solution in original post

5 REPLIES 5

Maybe using an action?

Not sure if I understand your question. A screenshot of your data table and current code would help a lot. Based on:


@Tmusky wrote:

What I want to do is have the Printing column auto fill by looking at column 1 (TASK) and seeing if it says Printing, then take the completion time from the Time column and put it in the Printing column.


I would say the bellow code would fulfill your request. Put it in the "App Formula" field in the Printing column.

 

IF([TASK] = "Printing", [Time], "")

 

If the TASK column has the "Printing" value, then this column value will be the same as the TIME column. Otherwise, it will be blank. You could do the same for all other columns, just changing the text comparison and time column. Take a look at:

IF() - AppSheet Help 

Define App formulas and Initial values - AppSheet Help 

 

So I tried this multiple times. with no success, but I found that for whatever reason my Task column was a "Enum List" Type and Not a "Enum" Type and that made all the difference in how the formulas work? Or it did in this case. This has been driving me bonkers!  Thank You so much this, It works to a point where I can finesse it into shape. Thank you again!! 

Lists behave differently compared to a single Value, this is part of the things you need to make sure when writting an expression.

Glad it's working now!

Yeah, Enum List, as the name says, is a list, so you need to compare it with another list or use the In function. You could do both:

 

IF([TASK] = LIST("Printing"), [Time], "")

 

I wouldn't recommend this one because it would only work if the user has selected only one option. Use instead:

 

IF(IN("Printing",[TASK]), [Time], "")

 

This one verifies if the "Printing" value is inside the TASK list of values. So it would work with multiple selections.

Good to know you figured the problem out.

Top Labels in this Space