set default data from a value in a joined table lightswitch RRS feed

  • Question

  • I'm trying to get a default value for a column from another table.  here is a basic mock of the db:

    order table:

    order_id, customer_id, item_id, cost, price, quantity

    item table:

    item_id, item_cost, item_price

    order table is joined to item table on item_id.

    The order has a price and cost and the item has a price and cost.  The item_cost and item_price are meant to be default price and cost and be put into the order tables cost and price fields on item creation.

    The problem that I am having is that the add item function expects to know the item when the dialog loads so I get a object reference error (which is to be expected), but I don't know how to solve.

    the idea is to do this when the object is created:

    me.cost = item.item_cost

    but this should happen AFTER I select the item from the list.

    for instance, I can set quantity as me.quantity = 1, but obviously quantity is just a value, not a field with a foreign key relationship...


    Saturday, September 14, 2013 3:16 AM