Working with a dependent dropdown from 2 different sources

Hi

I am trying to create a dependent dropdown menu. The first 2 questions come from a table called 'Services'  and the rest will come from another table called 'Media'. Both tables have 'Media Type' column.

If I select a service type of 'Vehicle Graphics' and an Application type of Basic (which are from the services table), there will only be one media Type option available i.e. Polymeric.

I need to get that value and find a match in the Media Menu, then display the dropdown options from the new table.

I need to do something like.. if services[Media Type] =  Media[Media Type] show a list of all media types from the Media Menu that match i.e. polymeric.

How can I do this? 

 

 

The next few questions come from a table called 'Media', this has many columns but it also has the 'Media Type' column.

If I select options from 

0 9 510
9 REPLIES 9

My response is mostly "huh?"

It would help if you showed screenshots of the tables and their data.

Also these should help:

https://help.appsheet.com/en/articles/961554-dependent-dropdown

https://help.appsheet.com/en/articles/2357314-select

 

Apologies.

Thanks for the links, I have already taken a look at them but I didn't find my answer.

So far, I tried the following filter:

 
Select(Media[Brand],
  Services[Media Type] = Media[Media Type]
)
 
Although no errors come up it doesn't work. Hopefully these screenshots will help.
 
Screenshot 2022-03-11 at 00.31.25.pngScreenshot 2022-03-11 at 00.31.17.pngScreenshot 2022-03-11 at 00.31.35.png
 
Basically I am trying to go through the dropdown menu until I get to Media Type (I don't need this as a selection or to be seen, it's just there so I can use it to match the records from the Media Table). Once I know what the media type is, I want to display the list of brands that match that. I then want to continue asking question from the media table that will show me a price.
 
I hope that makes sense now?

Select(Media[Brand],
  Services[Media Type] = Media[Media Type]
)

I know this may be confusing. I'll translate to you what your expression says.

"Select a list of Brand fields from the Media table if the list of all items of field Media Type on Services table is exactly the same string as the list of all items of the field Media Type on the Media table"

Take another look at Select() docs

https://help.appsheet.com/en/articles/2357314-select

Try to understand each of the arguments.

First, you have to indicate a Dataset[ColumnFromThatDataset]. Dataset may refer to a table or slice.

Second, you have to make a Yes/No expression that has to make sense. This Yes/No is evaluated for each of the rows (pretty uneficient) to decide whether it should be included or not.

Third, an optional Yes/no expression to decide if you want to just take unique values from the resulting list.

That's why we engourage to read the docs, the answers are there, just read them slowly and calm, without the need to solve and forget

https://help.appsheet.com/en/articles/961554-dependent-dropdown

Also, some other important info:

https://help.appsheet.com/en/articles/2423938-suggested-values-for-a-column

https://help.appsheet.com/en/articles/961544-dropdown-from-valid_if

https://help.appsheet.com/en/articles/961211-valid_if-column-constraint

https://help.appsheet.com/en/articles/961274-list-expressions

I appreciate your help and I appreciate that the question has been asked time and time again but reading the docs slowly still isn't helping, I've also searched time and time again through this page looking for scenarios like mine and although I have found similar, nothing is working. I've learnt basic Javascript quicker than this, I'm sure once you understand it it's easy but when you're starting out there's a lot going on. I've found this to be the same when working with Wordpress Sites, it takes longer to understand than it actually takes to code a website from scratch but when you do, it's easy.

I've read through the links provided and used this code:

SELECT(
Media[Brand] ,
    [Media Type] = 'Polymeric'
)

This works but it doesn't matter what media type was selected in the previous dropdown due to me manually typing the word 'Polymeric' in the function.

So I tried this

SELECT(
Media[Brand] ,
    [Media Type] = Services[Media Type]
)

I thought this would get the word from Service[Media Type] which is used in the previous dropdown

This won't work, giving me the error: Cannot compare Text with List in ([Media Type] = Services[Media Type])

What am I not understanding?

Not tested as these are not my strongest point in Appsheet , but maybe

SELECT(Media[Brand], IN([Media Type],Services[Media Type]))

@Ratatosk I appreciate the effort but it's not quite right.

Here's your code:

SELECT(
  Media[Brand],
  IN([Media Type],
    Services[Media Type]
  )
)

 

If I'm not mistaken, this is saying...

SELECT(Media[Brand] = Show the list of brands in my media table

IN([Media Type], = In the Media table from the Media Type Column

Services[Media Type]) = In the Services table from the Media Type Column

Is this right?

The reason why it doesn't work is because it lists all the brands irrespective of what was chosen in the previous menu.

I'm guessing it's because I need to use something like:

IN([Media Type] = Services[Media Type]

But that won't work

I got there.

SELECT(
  Media[Brand],
  [Media Type] = ([_THISROW].[Media Type]),
  TRUE
)

 

Now to make sure I understand it...

SELECT(Media[Brand], = Show this Table/column as the dropdown list

[Media Type] = ([_THISROW].[Media Type]), = Not sure I understand this line completely

  TRUE = If the above is true then show Media[Brand].

)

 

I need help understanding this line:

[Media Type] = ([_THISROW].[Media Type]),

Reading from the docs here: https://help.appsheet.com/en/articles/2357314-select

I believe [Media Type] means the current form which in this case would be Media table as I requested this here using this line: 

SELECT(Media[Brand]

Now [_THISROW].[Media Type] is getting the value from the dropdown list so..

If

the Dropdown list selection's value is 'A'

and there is a value of 'A' in the Media Table /  Media Type's Column

then this match  = true and show Media[Brand] which I asked for at the very beginning of the script.

Am I even close?

The dependent dropdown feature only works if the Valid If expressions are of the format

table[column]

and the Valid If expressions of all of the dependent dropdown columns refer to the same table. If you need more complex logic, such as involving another table, you cannot use the dependent dropdown feature. Instead, you'll have to provide full expressions to provide the more-complex logic.

Top Labels in this Space