Which expression is best to use in this example

Hi

I have an app that monitors swimmers who are either in or out of the pool. Each swimmer will enter and exit the pool twice. So I have the following columns:

[Start] Initial value of 00:00.

[Swim Exit 1] Initial value of 00:00.

[Swim Entry 2] Initial value of 00:00.

[Finish] Initial value of 00:00.

[Swim Status]

What expression would I use in column [Swim Status] to show whether the swimmer is “IN” or “OUT” of the pool?

TIA your expertise is much appreciated.

This goes to AppFormula of [Swim Status] column:

IFS(	
	OR(
		NOT([_THISROW_BEFORE].[START] = [_THISROW_AFTER].[START]),
		NOT([_THISROW_BEFORE].[SWIM ENTRY 2] = [_THISROW_AFTER].[SWIM ENTRY 2])
		
	),"IN",
	OR(
		NOT([_THISROW_BEFORE].[SWIM EXIT 1] = [_THISROW_AFTER].[SWIM EXIT 1]),
		NOT([_THISROW_BEFORE].[FINISH] = [_THISROW_AFTER].[FINISH])
	)"OUT"
)
1 Like

@LeventK thank you for your suggestion, however it came up with this error.

IFS function is used incorrectly:Inputs to IFS() must be one or more condition-value pairs.

1 Like

Missing comma. Try:

IFS(	
	OR(
		NOT([_THISROW_BEFORE].[START] = [_THISROW_AFTER].[START]),
		NOT([_THISROW_BEFORE].[SWIM ENTRY 2] = [_THISROW_AFTER].[SWIM ENTRY 2])
		
	),"IN",
	OR(
		NOT([_THISROW_BEFORE].[SWIM EXIT 1] = [_THISROW_AFTER].[SWIM EXIT 1]),
		NOT([_THISROW_BEFORE].[FINISH] = [_THISROW_AFTER].[FINISH])
	),"OUT"
)
3 Likes

@Steve @LeventK

Thank you both so much, this works.

Where can I go to learn this level of code?

1 Like

Here. And help.appsheet.com. And practice, practice, practice!

:smiley:

2 Likes

I perfectly agree. Here and official docs.

1 Like

To quote a song I like, Appsheet is 10% luck 20% skill more like 70% will and hundreds of hours in documents and crawling the forum. The 50% pain and pleasure is more like 90-10 but I digress.

3 Likes

@Steve, thank you.

would there be any reason why this expression would stop working if i update another column in this sheet?

I have other columns in the sheet, like feed 1, feed 2 etc, and it seems when I update these, the [Swim Status] expression (as above) doesnt work.