Accessing fields from multiple tables
-
Wednesday, August 01, 2012 11:25 AM
Hi,
Here my scenario: I am building a Workload Management System. In the system, I have courses. A course has many modules and a module can be taken by a member of staff.
When I select a certain course, I want to display the module names associated with the course as well as the staff name.
How do I go about solving this issue as I've tried to edit the preproccess query method but some reason I can't create a join?
Your help would be greatly appreciated.
Thanks,
Darryn
All Replies
-
Wednesday, August 01, 2012 11:40 AM
Hi
I think for your requirement no need to go for pre-process query.
As I understand, the relationship between Course and Module is One - To - Many. Am I Right? If yes then you can create a detail screen based on Course entity and in that screen also add child record like Modules. So that it will show the list of module for the particular course only. Now to show staff name in the module grid create a new column by selecting Other Screen Data... and choose the name of the staff.
Hope you want this...
Regards
Rashmi Ranjan Panigrahi
www.lightswitchspecial.com
If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”.
This will help other users to find their answer quickly.- Proposed As Answer by c4ctopus Wednesday, August 01, 2012 12:06 PM
-
Wednesday, August 01, 2012 12:22 PMModerator
What you're asking about requires what's called a "nested combobox", or a "cascading combobox". A combobox in LightSwitch is called an AutoCompleteBox (ACB).
Have a look at these two articles, they should give you an idea of what you need to do.
Nested AutoCompleteBox For Data Entry
Nested AutoCompleteBox for Data Entry Part 2
Essentially, you create a parametrised query for each of the comboboxes that depend on a value from the previous combobox, then link the dependent combobox to the previous combobox.
Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands If you find a reply helpful, please click "Vote as Helpful", if a reply answers your question, please click "Mark as Answer" By doing this you'll help people find answers faster. - Marked As Answer by Dino HeModerator Thursday, August 09, 2012 12:45 AM
-
Wednesday, August 22, 2012 10:17 AM
Hi Yann,
Sorry haven't got back to anyone, I encountered some problems so I had to put aside my project for a while.
I looked at the articles you referred me too. I followed them but as soon as I get to the parameter binding part, I can only display the staff names ones I clicked on the module and then it populates the whole Staff Name column with just the one person's name.
I want to the relevant staff name to appear next to each of the modules.
Thanks
Darryn
-
Thursday, August 23, 2012 6:06 AMModerator
To change what's displayed in an ACB, change its control type from "Summary" to a "ColumnsLayout". Then drag the property that you want to replace it with into the ColumnsLayout control.
This link is primarily for a Modal Window Picker, but the technique is the same:
Can I specify multiple columns in modal window picker?
Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands If you find a reply helpful, please click "Vote as Helpful", if a reply answers your question, please click "Mark as Answer" By doing this you'll help people find answers faster. - Marked As Answer by Darryn Pan Thursday, August 23, 2012 6:44 PM
-
Thursday, August 23, 2012 6:44 PM
Thanks Yann!
Worked well! :)
-
Friday, August 24, 2012 2:10 AMModeratorYou're welcome!
Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands If you find a reply helpful, please click "Vote as Helpful", if a reply answers your question, please click "Mark as Answer" By doing this you'll help people find answers faster.

