How to create a rule to assign roles to users based on some checkbox items in their profile? I am pretty new to Drupal. I am using Profile2 so that the user can select there own user role. So say I have a profile page with some checkbox items like


Automotive
Computer
Garden
etc


How would I add a condition or data comparison in Rules to say, If Automotive is selected/checked, set user role to that role? I also need to be able to select multiple checkboxes to get multiple roles. 

Any suggestions?
Part 1 - Make it work for a single selection and related role

Create a rule which looks like so:


Rules Event: After saving user profile.
Rules Conditions (both conditions must be satisfied):


entity has field (with the field corresponding to (eg) "Automotive".
data comparison to check if "Automotive is selected/checked".

Rules Action: : Assign role to user (for the role related to "Automotive").


You could create a similar rule for each possible combination of checkboxes and roles to be assigned. Or continue as detailed in Part 2 to further enhance your rule from Part 1 so that you end up with a single rule for all possible combinations.

Part 2 - Make it work for other possible combinations

To also make it work for other possible combinations, and because of the fact that a Rules action cannot contain "conditions", you basically have 2 possible approaches:


Create a similar rule (as in Part 1) for each possible combination.
Use the Conditional Rules module to enhance the Rules Action in the above rule to alter the flow, using either Conditional (if/else) of Switch logic. Be aware: this module only has a beta release for D7, though it's used in over 8K sites (which makes it seem like a pretty robust module though).