locked
Passing edit context to a screen RRS feed

  • Question

  • I have a very simple problem I do not know how to solve in LightSwitch. For illustration purposes I made up some objects which might not be ideal for the purpose of the question. Anyway, say I have a Company and a Location object. There is a Many to One relationship between the Company and the Location implying a Location can have many Companies and a Company must have one Location.

    I create a new Company from the Company list screen. On the new Company screen I have to select a Location or create one if the Company location does not exist already. For that purpose, I have a Location auto complete box and a button "Add Location" underneath the Location. The button open a new data screen for the Location entity. The problem is that Company is a new entity with and 0 Id not yet in the DataWorkspace so it can not be queried. From the add new Location screen I have no way to access the potential new Company object to set the Company.Location property to the newly created Location. Nor can I see a way to set the Location property in the new Company screen when I close the new Location screen.

    It is not an option to create the Company an save it first because it has a lot of required properties.

    Any ideas please?

    Willie

    Tuesday, December 11, 2012 2:57 PM

Answers

  • Nor can I see a way to set the Location property in the new Company screen when I close the new Location screen.

    Techniques for doing this have been described many times in the forum. Please refer to How to Communicate Across LightSwitch Screens for an example of a technique to propagate the effect of making changes in one screen to other screens.

    Justin Anderson, LightSwitch Development Team

    • Proposed as answer by babloo1436 Wednesday, December 12, 2012 4:42 AM
    • Marked as answer by W.A. Swart Wednesday, December 12, 2012 7:43 PM
    Tuesday, December 11, 2012 9:56 PM
    Moderator

All replies

  • Nor can I see a way to set the Location property in the new Company screen when I close the new Location screen.

    Techniques for doing this have been described many times in the forum. Please refer to How to Communicate Across LightSwitch Screens for an example of a technique to propagate the effect of making changes in one screen to other screens.

    Justin Anderson, LightSwitch Development Team

    • Proposed as answer by babloo1436 Wednesday, December 12, 2012 4:42 AM
    • Marked as answer by W.A. Swart Wednesday, December 12, 2012 7:43 PM
    Tuesday, December 11, 2012 9:56 PM
    Moderator
  • Thank you, that was sufficient.
    Wednesday, December 12, 2012 7:43 PM