Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date-if then else Post Reply Post New Topic
Author Message
Darla
Newbie
Newbie
Avatar

Joined: 23 Jun 2017
Online Status: Offline
Posts: 2
Quote Darla Replybullet Topic: Date-if then else
    Posted: 27 Jun 2017 at 7:33am

First time posting so I hope I have used the correct location.

I am using XI and need help on a if then else formula for dates.
 
We hire our temporary employees 60 days from their start date, however we only hire on the 1st and the 16th.
 
So if their start date is 1st-15th they would be hired +60 days on the 16th. If they started on 16th-31st then they would be hired +60 days on the 1st.       

Example

Org hire date is 04/24/17, his temp to perm date would be 07/01/17

Or

Org hire date is 05/15/17, his temp to perm date would be 07/16/17

I am having a heck of a time trying to figure this out.

Thank you

Darla

Thank you
Darla
IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 02 Jul 2017 at 11:50pm
Supposing your hire date field is of type Date, try this formula (Crystal Syntax):

DateVar DateMonthsAfter;
If day({Table.HireDate}) <= 15 Then
    (DateMonthsAfter := CDate(DateAdd("m", 2, {Table.HireDate}));
    DateValue(Year(DateMonthsAfter), Month(DateMonthsAfter), 16);)
Else
    (DateMonthsAfter := CDate(DateAdd("m", 3, {Table.HireDate}));
    DateValue(Year(DateMonthsAfter), Month(DateMonthsAfter), 1);)


Replace {Table.HireDate} by your real field.
IP IP Logged
Darla
Newbie
Newbie
Avatar

Joined: 23 Jun 2017
Online Status: Offline
Posts: 2
Quote Darla Replybullet Posted: 06 Jul 2017 at 8:17am

That works perfectly.

 
Thank you!
Thank you
Darla
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.