Hello AppSheet Community
I wrote the below expression to retrieve name values from the locations table whose Route is Broward and are designated as Mandatory AM:
sort(select(locations[name],and([Route?]="Broward",[Mandatory AM?]="TRUE")))
So when I double-check it it makes sense to me, but thereโs a bug in my app where this expression is returning stops from other routes as well. How do I correct this expression to be more specific?
Thank you.
-Tiffany
What type of a column is [Route?]? Make sure AppSheet didnโt autoset that column to be a yes/no column which it will do when you have a question mark in the column name. Also remove the quotes around true since you are checking true or false and not for the text โtrueโ. It may or may not matter, but just in case.
[Route?] is an Enum type. Should I change that?
I also tried using FILTER() instead of SELECT() but nothing changed.
Enum should be fine. I you temporarily add rich.ellis@appsheet.com to view your app definition, I can take a look and see what could be causing it.
Okay I did it. The column is Products in the Clipboard table and the large expression is under Auto Compute -> Suggested Values.
Thank you.
Yeah the problem is with the double quotes around true.
change the select() to this:
sort(select(locations[name],and([Route?]=โBrowardโ,[Mandatory AM?]=true)))
I did this and it didnโt make a difference for some reason. Is the problem the uppercase letters?
Since when?
Also, [Mandatory AM?]=true
is redundant; [Mandatory AM?]
is enough if the column type is Yes/No.
Yep the type is YES/NO. I checked.
Here is a test of row 4 with TRUE:
Row 4 with โTRUEโ quotes:
@Steve not sure I have always found it to cause me issues at times, so I never use quotes with y/n columns
Isnโt this picture just the same results no matter the quotation marks? Maybe Iโm misreading it.
No the results are in the left column. The first one returns 2 items, the second one has zero.
Other columns are blank when the quotes are used and not blank when no quotes are used. I checked in the table and it appears to be producing the correct results.
Do the โother routesโ have blank Route? column values?
Yes! Although I thought if the Route? column value was blank then the expression would evaluate to false and exclude that row.
Exactly the opposite.
Replace [Route?]="Broward"
with "Broward"=[Route?]
.
Wait so I was accidentally setting the value of Route? to equal Broward?
No, you werenโt setting anything; =
is a comparison.
[Route?]="Broward"
asks, is the Route? column vale the same as the literal text, Broward
?
"Broward"=[Route?]
asks, is the literal text, Broward
the same as the Route? column vale?
The problem is that the =
comparison has a quirk: if the value on the left side is blank, the result is TRUE regardless of the value on the right, so youโre best served to put a value you know will not be blank on the left.
Okay Iโm also going to eliminate the blank spaces in the backend and let you know if it works Thank you so much
Hello AppSheet,
I updated my code and the backend and the problem persists. Iโm going to email AppSheet Support about it but does anyone have any ideas on how to fix it? Thank you.
Thatโs a key quirk. I need to go check all my expressions with =
Wonder how many = Iโll find in my app documentation.
661!!!
User | Count |
---|---|
15 | |
15 | |
8 | |
7 | |
4 |