Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date comparison Formula

Status
Not open for further replies.

TPG_IT

Technical User
Oct 1, 2024
2
I am trying to create for a formula that compares dates. Below is the formula that I have created.

IF {SORDERP.YTP03EXPDAT_0} < {SORDERQ.EXTDLVDAT_0} then {SORDERQ.EXTDLVDAT_0} else (IF {SORDERP.YTP03EXPDAT_0} > # 12/30/29 # then 'TBA' else totext({SORDERP.YTP03EXPDAT_0}))

What I am trying to achieve is that the Expected Date is before the Ship Date, then to display the Ship Date, if not then if the Expected date if it is after the 30/12/2029 display TBA otherwise show the Expected date. Below are some examples of what I am trying to achieve.

TPG Expected DateShip DateWhat to Show
01/10/2407/10/2407/10/24
14/10/2408/10/2414/10/24
31/12/2909/10/24TBA
 
The challenge with this is that you have two different data types that you're trying to display. Crystal won't let you do that, so you'll have to convert the dates to strings because you can't convert "TBA" to a date. So, your formula will look like this:

IF {SORDERP.YTP03EXPDAT_0} < {SORDERQ.EXTDLVDAT_0} then
ToText({SORDERQ.EXTDLVDAT_0} , 'MM/dd/yy')
else IF {SORDERP.YTP03EXPDAT_0} > # 12/30/29 # then
'TBA'
else
ToText({SORDERP.YTP03EXPDAT_0}, 'MM/dd/yy')
-Dell
 
The challenge with this is that you have two different data types that you're trying to display. Crystal won't let you do that, so you'll have to convert the dates to strings because you can't convert "TBA" to a date. So, your formula will look like this:


-Dell
Hi

Thanks for your prompt response, this as solved my issue.

Regards

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top