Setting a Default coming from a related table


  • I have an "entity table" that has a "related table" Entity table<----Many to One---->Related Table so I can query results with "Entity tables" Autocomplete box control and that entries can be dynamically entered into the "related table". This was setup using Lightswitch I know in light switch if I want to set a default value of a property that has a choice list I have to enter

    .HowOrdered = "T.O.";

    Where T.O. is the stored value of a not the display name of the choice list and that instance works.

    I want to set up something similar for my dynamic choice list I setup in the "related table" so I tried.

    this.Procedure.Code = "0";

    Where Procedure is the name of the property relationship in the Entity and Code is the property in the related table. I get errors stating there is a null value problem when add new records with this line of code.  I have tried many other combinations of things like writing the _Created() method on the end of the Related table but this just gives me no default value on the Entity table. I also tried using other values like .ID but no luck how do I accomplish this task?

    Thursday, September 19, 2013 8:04 PM

All replies