Having trouble with the ANY() function. ANY(...

expressions
(Twenty West KC) #1

Having trouble with the ANY() function.

ANY(Table[Column]) does not seem to be returning a random value, but the first value in the list every time. Same thing with ANY(SELECT(Table[Column], TRUE)).

Am I reading the documentation wrong? It seems like either of these expressions should return a random value from the list.

(Levent KULAÇOĞLU) #2

@Twenty_West_KC

ANY expression always returns the first value in the list. Provided you want to return a random value from the list, you can use this expression:

INDEX(SPLIT(SELECT(TableName[ColumnName],TRUE),","),RANDBETWEEN(1, COUNT(TableName[ColumnName])))

(Praveen Seshadri (AppSheet)) #3

ANY() doesn’t guarantee which item it returns. The current implementation happens to return the first item in the list.

(Twenty West KC) #4

Thanks @Levent_KULACOGLU , I will give this a try

(Aleksi Alkio) #5

@Levent_KULACOGLU The SPLIT is not needed because the SELECT expression produces the list already.

(Levent KULAÇOĞLU) #6

Thanks @Aleksi_Alkio

I realized that later