Friday, July 27, 2012 7:25 PM
I was wondering if you could help me out with one more query as I am finding myself in dier straits when trying to resolve this.
I added a new table in the database using LighSwitch and added a relationship to an existing table which makes the field "required" in the existing table.
Now when I run the applicaton, it works fine when trying to add new records to the existing table but when trying to edit old existing records, screen does not allow to do so. It is only happening when I add the new relationship field in the existing table to the detail screen but when I take it off the screen, it allows me to edit the data which does not show the field (relationship field added while adding new table). Just to mention, it is a List with Auto Complete box which shows the data from the new table.
After running the sql query using managment studio, I found out that all the exisiting records have 0 in that new field and the new table starts with the value 1.
Just to make this more simpler, Lets say we have a table for Candidates. Now taking my scenario, I have added a new table called "SearchEngine" with columns ID, SearchEngineName. Now I have created a one to many relationship between these two tables. Now after running the application when I go to createnewcandidate screen it shows the SearchEngineUsed as Auto Complete box with no value in the drop down list (table "SearchEngine"). Now I can go to the create SearchEngine Screen and add new searchengine which will appear in the SearchEngineUsed drop down list in the createcandidate screen. This is as expected. However, when trying to look at the candidatedetails screen by clicking on the existing candidate (already existing recored in "Candidates" table) it shows all blank fields and does not allow me to edit the candidate. But when taking off the "SearchEngineUsed" field from the "candidatedetails" screen, it works but does not show searchengineused as we haven't included it in the screen.
I can go server managment studio to run an update query for all the existing records to update the added field to 1 which will show and allow me to edit the candidate in candidatedetails screen.
However, I am curious to know If there is anyway to get rid of this unconsistency in the application without running the sql update query. Is it possible to set the default value for this auto complete box so that all the existing records will get updated to default value? Just to inform, I am using VB, so if you could let me know how to achieve this, will buy you a beer...... :-)......will really appreciate it.Cheers
- Edited by SimpyS Friday, July 27, 2012 7:30 PM
Monday, July 30, 2012 8:09 AMModerator
According to your description ,I cannot reproduce your problem.
It would be appreciated if you can share a project with me in order to target the problem.
Monday, July 30, 2012 10:34 AMModeratorWhen you add the relationship, set the "Multiplicity" to 0..1-Many (zero or one), instead of 1-Many.
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 Otomii LuModerator Tuesday, August 07, 2012 5:39 AM