Reputation: 21
I have Table1
linked to Table2
with a 1 to 0..1
relationship. Table2
is read only, from another data source.
When Field1
(which defines a key to Table2
) is entered in an entry screen, I would like to have the Table2
data on the screen show the results that match Field1
.
For Example:
Table1
is "WidgetProblem"
Table2
is "Widget"
When the user enters the Widget ID in the Widget Problem screen, I want the details of the widget to show up on the screen, without first having to save and then edit / display the screen. I want the user to see the Widget information so that they can be sure they've got the correct widget.
The fields are all there, I just can't quite figure out how to trigger the data lookup "early". Back in the day I would just handle this on an event from the field, kick off a quick populate of the fields on the screen and be done. Obviously it's not the same in LightSwitch. Can anyone point me in the right direction?
Upvotes: 2
Views: 1021
Reputation: 3879
Seeing as you've already created the relationship between the tables, the WidgetProblem table/entity should have an added navigation property, more than likely called Widget (if you didn't change the name). You shouldn't need to be dealing with IDs yourself.
When you drag one of these navigation properties (from the left-hand side in the screen designer, over to the control tree), LightSwitch will display an AutoCompleteBox (a fancy name for a ComboBox) for you, so the user will be able to choose the desired Widget from a list of widget names, & the ID is automatically stored for you.
You sometimes really do have to "forget" what you already know from other technologies when you start to use LightSwitch. Trying to do things the way you would in those other technologies can cause frustration, until you learn to do things "the LightSwitch way".
This set of beginner videos, LightSwitch How Do I Videos, made by Beth Massi, should give you a good grounding of the various techniques that you'll need to get you started successfully creating LS applications.
Upvotes: 1