Answered by:
Some Do Some Don't

Question
-
I have a FamilyListDetails screen that doesn't show individual records although the related data is in the database and can be displayed using sql statements. Oddly, some a few of the individual records show when a FamilyName is clicked. When I click on the FamilyName link in the details section of the screen I open a Family Details page that displays the related individual just fine. When the individuals link is clicked, the details page does NOT show any details for records that don't show on the FamilyListDetails screen, but have data for the records that do show on that screen.
I wish I had more to say about this, but I don't have a clue what the difference in the records could be that would cause this inconsistency. Any ideas?
Thursday, February 21, 2013 6:13 AM
Answers
-
Hello
The picture that you added to your previous post shows that you added a relationship after you had added the data. LS doesnt go back and make sure that these exist which is why you are getting the orphaned records (as I said earlier).
I am not sure how you get those relationships back, but as you say it is test data you should be safe enough to just carry on from where you are.
If not then Yann may be best placed to help.
If you found this post helpful, please mark it as helpful. If by some chance I answered the question, please mark the question as answered. That way you will help more people like me :)
- Marked as answer by Darnell Tuesday, February 26, 2013 3:32 PM
Tuesday, February 26, 2013 11:01 AM -
The problem is with the table 'Individual' and the column will be 'Individual_School' or similar.
Dave Baker | Xpert360 blog | twitter : @xpert360 Opinions are my own. Please mark as answer if this helps solve your problem.
- Marked as answer by Darnell Tuesday, February 26, 2013 3:31 PM
Tuesday, February 26, 2013 2:53 PM
All replies
-
Is this happening at debug time and is it an intrinsic or external database?
This usually happens when some data that LightSwitch thinks is mandatory is missing or null. Could be a column, link/foreign key.
If it is an external database it may be that a schema change has not been refreshed back in LightSwitch.
Dave Baker | Xpert360 blog | twitter : @xpert360 Opinions are my own. Please mark as answer if this helps solve your problem.
- Proposed as answer by Yann DuranModerator Friday, February 22, 2013 12:32 PM
Thursday, February 21, 2013 8:17 AM -
I built the database in Lightswitch. How do I troubleshoot for the missing or null?
Thursday, February 21, 2013 1:46 PM -
Check the table that the records come from for mandatory columns, links and any choice lists.
Dave Baker | Xpert360 blog | twitter : @xpert360 Opinions are my own. Please mark as answer if this helps solve your problem.
Thursday, February 21, 2013 9:52 PM -
Ok, but to be honest, I am not quite sure what I am looking for. There are mandatory columns but I don't know how to find which one(s) Lightswitch has a problem with.Friday, February 22, 2013 3:48 AM
-
I am still trying to figure out what is going on. I hope the screen shots will help. I am utterly baffled. Some records show and some don't. If I click the link to details I get the child records on the details screen. Can anyone see anything that can help clear this up? All data is test data.Tuesday, February 26, 2013 3:59 AM
-
Have you changed the link between the parent and child records after you had entered some data?
Also if you enter fresh data doesit react in the same way?
What are you linking the records on?
It does sound as if LS has orphaned the child records
If you found this post helpful, please mark it as helpful. If by some chance I answered the question, please mark the question as answered. That way you will help more people like me :)
Tuesday, February 26, 2013 6:24 AM -
Fresh data behaves as it should. I didn't (knowingly) change any links. I did add a new relationship to the individuals table. Another thing I find odd is that when I create a new list details screen, I get the same orphaned record behavior.
The records are being linked on PK/FK id to id. (if I understand the question correctly)
- Edited by Darnell Tuesday, February 26, 2013 10:39 AM
Tuesday, February 26, 2013 10:24 AM -
That relationship could easily be the problem. There is data integrity enforced at the database level (which cannot be your problem) and rules enforced by LightSwitch data layer (which is the problem with existing data).
You need to show us a decent view of the entity relationships in the designer. There is insufficient info to go on so far. Thx.
Dave Baker | Xpert360 blog | twitter : @xpert360 Opinions are my own. Please mark as answer if this helps solve your problem.
Tuesday, February 26, 2013 10:29 AM -
Ok. What view do you need of the designer? or what kind of view?Tuesday, February 26, 2013 10:59 AM
-
Hello
The picture that you added to your previous post shows that you added a relationship after you had added the data. LS doesnt go back and make sure that these exist which is why you are getting the orphaned records (as I said earlier).
I am not sure how you get those relationships back, but as you say it is test data you should be safe enough to just carry on from where you are.
If not then Yann may be best placed to help.
If you found this post helpful, please mark it as helpful. If by some chance I answered the question, please mark the question as answered. That way you will help more people like me :)
- Marked as answer by Darnell Tuesday, February 26, 2013 3:32 PM
Tuesday, February 26, 2013 11:01 AM -
@Otis
The relationship I added was to a schools table. I don't understand why that would effect the Family/Individual relationship. The relationship between Family and Individual existed from the beginning of the project.
Tuesday, February 26, 2013 11:27 AM -
@Xpert360
Is there a designer xml file or something of that nature I need to show? I am trying to provide anything and everything to fix this.
Tuesday, February 26, 2013 11:33 AM -
@Otis
The relationship I added was to a schools table. I don't understand why that would effect the Family/Individual relationship. The relationship between Family and Individual existed from the beginning of the project.
As I said previously, you added a relationship after you added the data. LS doesnt go back and make sure that all the other relationships that are needed are present. I have been caught out like this before so I try and make sure that I have the data structure correct before I get decent data into the database.If you found this post helpful, please mark it as helpful. If by some chance I answered the question, please mark the question as answered. That way you will help more people like me :)
Tuesday, February 26, 2013 2:13 PM -
@Otis is correct. You probably can fix the data by using SSMS or other SQL tool to link orphaned 'Individual' records to a school.
Dave Baker | Xpert360 blog | twitter : @xpert360 Opinions are my own. Please mark as answer if this helps solve your problem.
Tuesday, February 26, 2013 2:20 PM -
Ok, I am confused. When I query the database using sql, I get all of the records, NO orphans (shown below). When I look at the Family Details screen, (shown above), I see the correct child records. In the screen shots, I use the Mason girls to illustrate. It is only on the List Details screen that the records don't show.
Tuesday, February 26, 2013 2:46 PM -
The problem is with the table 'Individual' and the column will be 'Individual_School' or similar.
Dave Baker | Xpert360 blog | twitter : @xpert360 Opinions are my own. Please mark as answer if this helps solve your problem.
- Marked as answer by Darnell Tuesday, February 26, 2013 3:31 PM
Tuesday, February 26, 2013 2:53 PM -
OK guys, I found it. The school table values had to be updated! That fixed everything. The id field being a required one needed something other than 0.
Thanks for your patience with me guys!!
Tuesday, February 26, 2013 3:36 PM -
Glad you got there in the end :)
If you found this post helpful, please mark it as helpful. If by some chance I answered the question, please mark the question as answered. That way you will help more people like me :)
Tuesday, February 26, 2013 3:38 PM