Entering a field value from a variable dependant on checkboxes selected

Entering a field value from a variable dependant on checkboxes selected

Hi all,

I have been working on this for hours now and am still struggling to find the right process to do this.

I have a form with a few checkboxes:

1) All Students
2) All Staff
3) Members of the Public  

For the purpose of reporting, I have a hidden field which I would like to effectively enter values dependant on the selection above.  

I originally set this hidden field to contain values according to what was selected, so if all the checkboxes aren't selected, I would end up with null in place of non-selected fields:

All Students, null, null

So how do I get around this?  I try another option...

My next attempt has been to try to define variables for all the combinations as follows:

MultiStudents = "All Students";
MultiStaff = "All Staff";
MultiPub = "Members of the Public";
StudentsStaff="All Students, All Staff";
StudentsPub="All Students, Members of the Public";
StudentsStaffPub="All Students, All Staff, Members of the Public";
StaffPub="All Staff, Members of the Public";

I then tried to create nested if statements to deal with this, using the contains option.  This is one example of a code section in the event of all options being selected:

//If All checkboxes selected;
if(input.Who_at_Risk.contains("All Students"))
{
if(input.Who_at_Risk.contains ("All Staff"))
 {
 if(input.Who_at_Risk.contains ("Members of the Public"))
  {
  At_Risk_Def_H=StudentsStaffPub
}}}

Unfortunately, I am just getting error after error on these and am guessing there is a simpler way of achieving this. Is there an easier way or are the errors down to my syntax being incorrect or nested if statements not being possible?

I am appealing to the experienced out there for some help on this.  I have only been programming Creator for a few weeks, so please be kind!

Thanks very much