Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: "ToText" with dates Post Reply Post New Topic
Author Message
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Topic: "ToText" with dates
    Posted: 13 Jan 2015 at 4:42am
I am trying to display a based on some arithmetic. The formula I am using is this


if {Table.Field} = "A"
then
"See Notes"
else
if
{Table.Field} = "B"
then
totext(({Table.DateTime} +2)-today, "dd-MMM-yyyy")
else if
{Table.Field} = "C"
then
totext(({Table.DateTime} +9)-today, "dd-MMM-yyyy")
else if
{Table.Field} = "D"
then
totext(({Table.DateTime} +119)-today, dd-MMM-yyyy")


When I create the formula I am told there are no errors.
When I add the formula to the report and refresh I get an error saying

"Bad Number Format String"

My end result would be to show a date something expires based on the math.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jan 2015 at 6:00am
({Table.DateTime} +2)-today
will return a number
what is the 'math' you are trying to accomplish?
IP IP Logged
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Posted: 13 Jan 2015 at 6:24am
So yes the formula you provided will return a number, but not a date. I need a calendar date. Because of the one special case where the output of the formula will be a text string is throwing off the whole works

Edited by bremen - 13 Jan 2015 at 6:26am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jan 2015 at 6:36am
but was is the logic for the date?
I don't know what table.date+2 - today is suposed to equate to
table.date+2 is straight forward but the "-today" does not make any sense to me
IP IP Logged
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Posted: 13 Jan 2015 at 7:15am
It is for a count down. It displays a "Days Remaining" Number. The formula to produce the number is working fine. I need a separate formula to produce a calendar date.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jan 2015 at 7:27am
then format it as a number instead of a date
totext(({Table.DateTime} +2)-today, 0",")
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.020 seconds.