# Conditional test error

(Rpd Mobile Apps) #1

Hi Appsheet!

I have found this bug in my app that took me a lot of time to narrow down to this simple expression:

MIN(LIST([DateTime1], [DateTime2], [DateTime3])) = [DateTime1]

Here, I am comparing the value of the first DateTime stamp with a DateStamp column. It always returns TRUE.

I paraphrased the expression with this and the expression returns the desired output:

NOT(MIN(LIST([DateTime1], [DateTime2], [DateTime3])) <> [DateTime1])

1 Like
#2

I assume you already checked what just â€śMIN(LIST([DateTime1], [DateTime2], [DateTime3]))â€ť is actually returning? Might help to provide that info and what the value of DateTime1 actually is. If you are comparing a date vs datetime.

(Steve Coile) #3

Are â€śDateTime stampâ€ť and â€śDateStampâ€ť the same thing?

(Steve Coile) #4

What does this mean?

(Steve Coile) #5

And to be clear, MIN() used with chronological types returns the earliest/oldest value.

(Rpd Mobile Apps) #6

@Mike

Ow sorry I made a typo. They are all DateTime values, there is no Date value in the expression.

[DateTime1] = â€ś3/21/2019 8:00:00â€ť
[DateTime1] = â€ś3/21/2019 7:59:00â€ť
[DateTime1] = â€ś3/21/2019 7:58:00â€ť

I was comparing if the earliest of the 3 DateTime values equate to the first DateTime value. Using the MIN() function, I tried to get the earliest DateTime value and then tried to compare to the first DateTime value.

The first expression was checking using the direct method of:
â€śIs earliest DateTime equal to the first DateTime value?â€ť
- This always returns TRUE, with whatever values I put in the 3 columns.

So I tried to reconstruct by wrapping the expression with NOT() and replaced the equal sign with not equal (<>).
â€śOpposite of the value given by (Is earliest DateTime not equal to the first DateTime value?)â€ť
- This now give me the logical value.

I hope I explained clearly

(Rpd Mobile Apps) #7

@Steve

Sorry I made a typo. They are all DateTime values. I meant â€śparaphrasedâ€ť by reconstructing the expression. I used LIST() to construct a list of DateTime values, and MIN() to get the earliest DateTime from that list.

1 Like
(Steve Coile) #8

Does the following return the correct value?

`min(list("3/21/2019 8:00:00", "3/21/2019 7:59:00", "3/21/2019 7:58:00"))`

(Steve Coile) #9

I have some concern that your posts use the fancy quotation marks. In the past, Iâ€™ve noticed others have had problems using fancy quotes in expressions. You might try disabling â€śsmart quotesâ€ť and replacing the ones already there with non-fancy ones.

(Rpd Mobile Apps) #10

Hi @Steve

Yes min(list(â€ś3/21/2019 8:00:00â€ť, â€ś3/21/2019 7:59:00â€ť, â€ś3/21/2019 7:58:00â€ť)) returns the correct value. The error happens when the parameters are taken from column values and the equality sign is added to make a conditional test. One thing to note here is that when comparing DateTime values exclusively (ex. DateTime1 = DateTime2 ), the output is logically correct. However when applying the whole expression that uses MIN(), LIST() and equality sign (=), the output is always true.

1 Like
(Rpd Mobile Apps) #11

@Steve

Hi Steve!

I made the initiative of recreating the whole app project from scratch and the same expression works fine now. I do not know why the error still exists in the old app, but somehow the error does not bother in my new app anymore.

I hope you could help me in later concerns. Thank you

(Steve Coile) #12

Ugh. Well, I too have had problems that were fixed by recreating the app. Iâ€™m sorry it took that,