Expression Help

Hey Guys,

Little lost,

Im trying to build an inventory App.

Contains the following components.

  1. Vendors.
  2. Catagories.
  3. Items.

I have a form regarding the inventory and As the user fills out the form, I only want the items to show up in the enum based on the Vendor and Catagorie they selected.

This is the formula I am using in the Valid If field of my Item field.

SELECT(Type[Item Name],  
And(Type[Catagory].[Catagory] = [_THISROW].[Catagory],
Type[Vendor].[Vendor] =[_THISROW].[Vendor]), FALSE)

It currently returns Blank. If I donโ€™t have this expression it Contains all types from all vendors and categories.



Solved Solved
0 7 261
1 ACCEPTED SOLUTION

You are close! The expression is actually simpler:

SELECT(Type[Item Name],  
       And( [Catagory] = [_THISROW].[Catagory], 
            [Vendor] = [_THISROW].[Vendor]))

The SELECT automatically knows context so knows that Catagory and Vendor are in the Type table. [_THISROW] is only needed because the columns in the current table have the same name as what was used in the Type table (perfectly ok). But had your row columns been different names [_THISROW] could have been removed.

View solution in original post

7 REPLIES 7

You are close! The expression is actually simpler:

SELECT(Type[Item Name],  
       And( [Catagory] = [_THISROW].[Catagory], 
            [Vendor] = [_THISROW].[Vendor]))

The SELECT automatically knows context so knows that Catagory and Vendor are in the Type table. [_THISROW] is only needed because the columns in the current table have the same name as what was used in the Type table (perfectly ok). But had your row columns been different names [_THISROW] could have been removed.

Wow,

Working perfectly.

I am getting Triangles beside each option in the list for all options. What could this mean?

See below
2X_4_4a4624222482dc31a4c7dea6294b5de35c7745af.png

In your SELECT you should actually use the KEY column from your Type table. Then in the AppSheet table editor set the โ€œItem Nameโ€ column as the Label. AppSheet will record the Key in the data but use the Label for display.

Wow,

Ok, So can you explain your thinking behind this? The triangles are gone but why?

The Valid_IF is actually determining if the values in the list returned are valid values from the table used in the SELECT(). AppSheet does this in a Ref column by using the Key column in the referenced table. When you specify another column in the SELECT(), none of those values are keys so AppSheet doesnโ€™t find a match and marks them as INVALID.

In even simpler termsโ€ฆ Since the column is marked Ref pointing to another table, AppSheet expects the column to have Key values from the other table, so as to successfully โ€œlinkโ€ them. No Key values means no โ€œlinkโ€. No โ€œlinkโ€ when AppSheet expects one means yellow triangle of doom.

Delete these prefixes :
Type[Catagory]. and Type[Vendor].

Top Labels in this Space