Monday, April 11th, 2011
Adding choice data and Relationships
In this post, we’ll add new tables for creating orders and order details. We’ll also add relationships between the tables from different datasources (Products & Orders) and use in the application.
- Right click the solution explorer right click Application data under data sources and select Add table. Name the table Order and add a new field for Payment Type as given below.
- For the lookup options for Payment type, in the properties, click on the choice list link.
- In the choice list add the following options and select OK.
- Now we’ll add a relationship between customer and order. For this select Customer table and click on Relationships from the toolbox commands.
- Add a One-to-many relationship between customers and orders. You can also specify the delete behavior on the relationship as given below.
- Add another table OrderDetails for specifying the products purchased in the order and the quantity for each product. Add relationships for Order and Products for this table as given below.
- The final output of the order details table looks like
Next we’ll see how to create an order and add products to the orders via lightswitch screens.