In LightSwitch, how do I restrict the list of choices on related tables?
-
21-12-2019 - |
Question
I'm creating a LightSwitch app and I have a set of related tables. Warehouses have many Racks. Racks have many Shelves. Shelves have many Bins.
I've created a NewBin screen and Warehouse, Rack and Shelf appeared as drop-downs. But they contain all values. I'd like the user to be able to select Warehouse and have it show only the appropriate Racks, automatically, and then select a Rack and have it show only the appropriate Shelves.
Is this possible in LightSwitch 2013?
Solution
This is how I do it in LS 2012. Hope it helps.
- Create a query for Shelves, add a parameter, will call it X in this example
- Add a filter in the query, setting Rack PK = X
- Go to the screen designer
- Add the query into the designer
- Go to the properties window for the Shelve drop-down control
- Change the field "Choices:" from auto to the name of the query you created
- Go to the properties window for the PARAMETER you created
- Set the "parameter binding" for X to the correct value. E.g. Warehouse.SelectedItem.Rack.PK
That's it.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow