How to copy values from one field to another with conditions?