locked
Checkboxes Group Validation RRS feed

  • Question

  • Good Day,

    Need help with the following scenario.

    in my solutions customers are required to present some paper work, and for each paper work presented a check box is ticked  & database is updated.

    on entering paper work screen i should have a simple label or so that indicated all paper work is present "all check boxes are checked" as shown in the attached image.

    am still experimenting with light switch and this part is tricky for me, any assistance would be greatly appreciated.

    Tuesday, February 9, 2016 10:39 AM

Answers

  • Do you want to get the total number that you selected in your DataGridView and then display it under the image? Please refer to

    http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/17/It-Is-Easy-To-Display-Counts-And-Percentages-In-LightSwitch.aspx

    Thursday, February 11, 2016 10:20 AM
  • Hello

    The link that Mortene has sent is one way but is more designed to collating all results and it looks like you want results per student. In your case I would create a computed column on your student column and then put in code that checks to see if they are all checked.

    To prove this I mocked up the two tables below...

    Tick box table

    Student table

    and as you can see they have a 0-1::1 relationship between them. Then in the PaperGood computed column you have the following code

            partial void PaperGood_Compute(ref bool result)
            {
                // Set result to the desired field value
                bool goodPaper = false;
    
                if(this.ExportPreReq.GMApproved == true && this.ExportPreReq.FordApproved == true && this.ExportPreReq.FiatApproved == true 
                    && this.ExportPreReq.ExperienceDoc == true && this.ExportPreReq.FlashMob == true && this.ExportPreReq.InExperienceDoc == true 
                    && this.ExportPreReq.OutExperienceDoc == true && this.ExportPreReq.FlashMob == true)
                {
                    goodPaper = true;
                }
                result = goodPaper;
            }

    This will then give you a value that you can put under your picture :)


    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 :)

    • Proposed as answer by Otis Ranger Friday, February 12, 2016 3:56 PM
    • Marked as answer by Adham El-Wakeel Saturday, February 13, 2016 9:36 AM
    Friday, February 12, 2016 3:56 PM

All replies

  • Do you want to get the total number that you selected in your DataGridView and then display it under the image? Please refer to

    http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/17/It-Is-Easy-To-Display-Counts-And-Percentages-In-LightSwitch.aspx

    Thursday, February 11, 2016 10:20 AM
  • Hello

    The link that Mortene has sent is one way but is more designed to collating all results and it looks like you want results per student. In your case I would create a computed column on your student column and then put in code that checks to see if they are all checked.

    To prove this I mocked up the two tables below...

    Tick box table

    Student table

    and as you can see they have a 0-1::1 relationship between them. Then in the PaperGood computed column you have the following code

            partial void PaperGood_Compute(ref bool result)
            {
                // Set result to the desired field value
                bool goodPaper = false;
    
                if(this.ExportPreReq.GMApproved == true && this.ExportPreReq.FordApproved == true && this.ExportPreReq.FiatApproved == true 
                    && this.ExportPreReq.ExperienceDoc == true && this.ExportPreReq.FlashMob == true && this.ExportPreReq.InExperienceDoc == true 
                    && this.ExportPreReq.OutExperienceDoc == true && this.ExportPreReq.FlashMob == true)
                {
                    goodPaper = true;
                }
                result = goodPaper;
            }

    This will then give you a value that you can put under your picture :)


    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 :)

    • Proposed as answer by Otis Ranger Friday, February 12, 2016 3:56 PM
    • Marked as answer by Adham El-Wakeel Saturday, February 13, 2016 9:36 AM
    Friday, February 12, 2016 3:56 PM
  • Thank you guys so much for you help, really appreciate it...i did figure it eventually and it's actually that same resolution but came with a lot of head banging.

    nevertheless, you contribution is greatly appreciated...keep up the good work.

    Saturday, February 13, 2016 9:37 AM