3 Replies Latest reply on Jul 14, 2009 4:54 PM by comment_1

# Help performing a conditional calculation!

### Title

Help performing a conditional calculation!

### Post

Hey, everybody.

I want to be able to enter in a date in one field and have it automatically fill in a date that is either 7 or 14 days later in another field, depending on the value that is present in yet another field (a contact's group membership). So, if a contact is a member of group 1A, then the date automatically filled in will be 14 days later than the date I manually enter, but if a contact is a member of group 1B, then the date filled in will be 7 days after the date I manually enter.

Any help you could provide would be VERY much appreciated!! Thank you!

• ###### 1. Re: Help performing a conditional calculation!
Auto-enter calculation = case ( Group_Membership = "1A", date_field + 14, date_field + 7 )
• ###### 2. Re: Help performing a conditional calculation!

Create a calculation (result is date) with:

ManualDate + Case ( Group Membership = "1A" ;  14 ; 7 )

Now ... if there are other groups then should get only the ManualDate then change the calculation to:

ManualDate + Case ( Group Membership = "1A" ;  14 ; Group Membership = 1B ;  7 )

UPDATE:  This calculation would throw a strange date if the manual date was not yet entered.  So I recommend wrapping it with a test and having it only evaluate if there is a ManualDate.  It would be:

Case ( ManualDate ;

ManualDate + Case ( Group Membership = "1A" ;  14 ; 7 )

)

• ###### 3. Re: Help performing a conditional calculation!
I would keep the values 7, 14, etc. in a field of the Groups table, and make the calculation =

Datefield + Group:: Days

Whether the result should be a calculation field or a date field with auto-entered calculation depends on what do you want to happen when the group value is modified.