Conditional test error

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 11 410
11 REPLIES 11

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.

@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

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"))

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.

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.

@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

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

Steve
Platinum 4
Platinum 4

Are “DateTime stamp” and “DateStamp” the same thing?

@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.

Steve
Platinum 4
Platinum 4

What does this mean?

Steve
Platinum 4
Platinum 4

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

Top Labels in this Space