Last post Aug 30, 2012 08:21 AM by sandston
None
0 Points
5 Posts
Aug 30, 2012 05:56 AM|sandston|LINK
I am quite a newbie to Crystal Reports so bear with me if I do not provide all the relevant information first off. Below is my formula: if {?ARR_DEP} = "A" then {FLIGHTD_ALL.ACTUAL} else if {FLIGHTD_ALL.CANCEL_CODE} = "C" then "" else {FLIGHTD_ALL.OFFCHOCKS} when I attempt to validate the formula advises me that a sring is required. Any advice or guidance would be much appreciated.
Participant
1882 Points
1051 Posts
Aug 30, 2012 05:58 AM|Dan Bracuk|LINK
You have nested if/else blocks but the outer one is incomplete.
1130 Points
239 Posts
Aug 30, 2012 06:03 AM|Rajesh Sawant|LINK
Hi, Kindly check the DataType for all mentioned below , it may be possibility that data might be string & you are referring it as integer, ARR_DEP FLIGHTD_ALL.CANCEL_CODE FLIGHTD_ALL.OFFCHOCKS While comparing please check whether is it String or Numeric / Integers
Hope this will work for you.
Aug 30, 2012 06:03 AM|sandston|LINK
Hey Dan,
Thank you for the response, I understand vaguely is there an easy way around resolving the last incomplete nested if/else statement.
Aug 30, 2012 06:16 AM|sandston|LINK
Hi Rajesh,
ARR_DEP is either an A or a D,
CANCEL_CODE is either blank or a C
FLIGHTD_ALL.OFFCHOCKS is 23/07/2012 16:10:00 (for example)
Contributor
6622 Points
1743 Posts
Aug 30, 2012 06:49 AM|Ajay2707|LINK
Hi Sandston,
The output of this formula must be same either from if or else condition.
In your datetime field, convert into string.
ToText({your_date_field})
Also please specify return keyword.
Aug 30, 2012 07:21 AM|sandston|LINK
Hi Ajay,
I modified the code to:
if {?ARR_DEP} = "A" then {FLIGHTD_ALL.ACTUAL} else if {FLIGHTD_ALL.CANCEL_CODE} = "C" then "" else ToText({FLIGHTD_ALL.OFFCHOCKS} )
but advises a date-time is required here.
Aug 30, 2012 07:27 AM|Ajay2707|LINK
check this.
http://forums.asp.net/t/1221808.aspx/1
http://stackoverflow.com/questions/1154785/crystal-reports-a-string-is-required-here-formula-error
Aug 30, 2012 07:28 AM|Ajay2707|LINK
Hi,
see this also.
http://www.forumtopics.com/busobj/viewtopic.php?p=738951
Aug 30, 2012 08:21 AM|sandston|LINK
I have managed to find a solution for the problem thanks to everyone that assisted with this:
if {?ARR_DEP} = "D" and {FLIGHTD_ALL.CANCEL_CODE} <> "C" then
""
else
if {?ARR_DEP} = "A" and {FLIGHTD_ALL.CANCEL_CODE} <> "" then
ToText({FLIGHTD_ALL.ACTUAL})
ToText({FLIGHTD_ALL.OFFCHOCKS})
None
0 Points
5 Posts
A String Required
Aug 30, 2012 05:56 AM|sandston|LINK
I am quite a newbie to Crystal Reports so bear with me if I do not provide all the relevant information first off.
Below is my formula:
if {?ARR_DEP} = "A" then
{FLIGHTD_ALL.ACTUAL}
else
if {FLIGHTD_ALL.CANCEL_CODE} = "C" then
""
else
{FLIGHTD_ALL.OFFCHOCKS}
when I attempt to validate the formula advises me that a sring is required.
Any advice or guidance would be much appreciated.
Participant
1882 Points
1051 Posts
Re: A String Required
Aug 30, 2012 05:58 AM|Dan Bracuk|LINK
You have nested if/else blocks but the outer one is incomplete.
Participant
1130 Points
239 Posts
Re: A String Required
Aug 30, 2012 06:03 AM|Rajesh Sawant|LINK
Hi,
Kindly check the DataType for all mentioned below ,
it may be possibility that data might be string & you are referring it as integer,
ARR_DEP
FLIGHTD_ALL.CANCEL_CODE
FLIGHTD_ALL.OFFCHOCKS
While comparing please check whether is it String or Numeric / Integers
Hope this will work for you.
//Happy Coding
Regards,
RajeshS.
None
0 Points
5 Posts
Re: A String Required
Aug 30, 2012 06:03 AM|sandston|LINK
Hey Dan,
Thank you for the response, I understand vaguely is there an easy way around resolving the last incomplete nested if/else statement.
None
0 Points
5 Posts
Re: A String Required
Aug 30, 2012 06:16 AM|sandston|LINK
Hi Rajesh,
ARR_DEP is either an A or a D,
CANCEL_CODE is either blank or a C
FLIGHTD_ALL.OFFCHOCKS is 23/07/2012 16:10:00 (for example)
Contributor
6622 Points
1743 Posts
Re: A String Required
Aug 30, 2012 06:49 AM|Ajay2707|LINK
Hi Sandston,
The output of this formula must be same either from if or else condition.
In your datetime field, convert into string.
Also please specify return keyword.
None
0 Points
5 Posts
Re: A String Required
Aug 30, 2012 07:21 AM|sandston|LINK
Hi Ajay,
I modified the code to:
if {?ARR_DEP} = "A" then
{FLIGHTD_ALL.ACTUAL}
else
if {FLIGHTD_ALL.CANCEL_CODE} = "C" then
""
else
ToText({FLIGHTD_ALL.OFFCHOCKS} )
but advises a date-time is required here.
Contributor
6622 Points
1743 Posts
Re: A String Required
Aug 30, 2012 07:27 AM|Ajay2707|LINK
Hi Sandston,
check this.
http://forums.asp.net/t/1221808.aspx/1
http://stackoverflow.com/questions/1154785/crystal-reports-a-string-is-required-here-formula-error
Contributor
6622 Points
1743 Posts
Re: A String Required
Aug 30, 2012 07:28 AM|Ajay2707|LINK
Hi,
see this also.
http://www.forumtopics.com/busobj/viewtopic.php?p=738951
None
0 Points
5 Posts
Re: A String Required
Aug 30, 2012 08:21 AM|sandston|LINK
I have managed to find a solution for the problem thanks to everyone that assisted with this:
if {?ARR_DEP} = "D" and {FLIGHTD_ALL.CANCEL_CODE} <> "C" then
""
else
if {?ARR_DEP} = "A" and {FLIGHTD_ALL.CANCEL_CODE} <> "" then
ToText({FLIGHTD_ALL.ACTUAL})
else
ToText({FLIGHTD_ALL.OFFCHOCKS})