set a attribute value based on another attribute in the same entity

i have attribute with 2 columns. column1, column2 one two three   i need to set column2 = 1 where column1=one    AND column2=2 where column1=two , and so on. how to achieve this, need idea..  
1 answers

If you want to set the RoleName based on the value of Group, then I would do the following. Assuming that the Group value is of String.

I named My example entity DataImport

  1. Iterate over the list
  2. Check on the first possible value
  3. If true, set RoleName accordingly
  4. If false, Check on value 2
  5. … etc
  6. Commit the changed list after the loop


By the way, if you want to set the USERROLE for accounts in order to login in. Take a look at this learning path to understand how ACCOUNTS can be created automatically;