Filter and Drop Downs

I'm hoping that I can get pointed in the correct direction.  I'm new to appsheet and have spent about a month working on a project.  Its based on completing inspections on vehicles.  I have three tables, one for the vehicle, one for the inspection, and one that would haver the list of items tat is expected to be in each compartment of each vehicle, as they are all different. Basically I want to have the app dynamic so that depending on which vehicle is selected it will populate the drop down menus for each compartment with different items depending on that truck.  I have been trying to use the select function as follows:

select(Compartments[Compartment 1], [_THISROW].[Compartment Vehicle Selection] = Compartments[Vehicle])

I've gotten mixed results with the newest error telling me that it cannot compare a text with a list. I've scoured the youtube videos and figured out how to do the VALID if dependent drop downs but that doesn't seem to work for my application either.  Any help in the right direction would be great, thanks. 

0 2 64
2 REPLIES 2

In constructing (grammatically) correct expressions, it is VERY important that you understand what type of data an expression (and various parts of the expression) returns. You have to refer to the AppSheet documentation for this.

select(Compartments[Compartment 1], [_THISROW].[Compartment Vehicle Selection] = Compartments[Vehicle])

Here, [_THISROW].[Compartment Vehicle Selection] is a single value (I am assuming [Compartment Vehicle Selection] is of type text) and Compartments[Vehicle] is definitely a LIST and you cannot compare a text with a list as your error message indicates.

In your specific case, you probably need a validation table that lists legal combinations of truck, compartment, item.

Validation: id, truck type, compartment, item

In the compartment of the inspection  col, put an expression like

SELECT(
 validation[compartments],
 [truck] = [_THISROW].[truck],
 TRUE
)

for the item col,

SELECT(
 validation[item],
 AND(
  [truck] = [_THISROW].[truck],
  [compartment] = [_THISROW].[compartment]
 ),
 TRUE
)

Hope this will be helpful.

 

You my friend are amazing!! As I said I have been playing around with this program for about a month, and knew that I was missing something....you fixed my biggest problem!!! Thank you for your time and response I wish you well. 

Top Labels in this Space