?
Solved

InfoView - Bad Date Format String Details: errorKind (?)

Posted on 2009-04-14
6
Medium Priority
?
1,975 Views
Last Modified: 2012-05-06
Infoview Only - I'm running a report that builds a date field from a string and fails on the first line of the following formula.
------------
//DRPT
StringVar YY;
StringVar MM;
StringVar DD;
StringVar DOLR;
YY:=Left(ToText({CMHR.DATRPC}),4);
MM:=Mid(ToText({CMHR.DATRPC}), 5,2);
DD:=Right(ToText({CMHR.DATRPC}),2);
DOLR:= DD & "/" & MM & "/" & YY;
CDate(DOLR);
----------------

When running the report through Crystal Reports XI; there are no issues.

Any ideas?
0
Comment
Question by:ansvarit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 24149308
If the date field is a string, why are you converting to a string?

mlmcc
0
 

Author Comment

by:ansvarit
ID: 24153300
mlmcc;

I'm taking a field from our database that is a string date; 20090101
I'm breaking up the string; and then rebuilding to format in Australia date format.
Then the string is converted to a date variable for display only. CDate ()

Essentially; the error on Infoview is coming back before reading any data, and is even erroring on the commented field //DRPT
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 24153872
Have you tried the formula like this


YY:=Left({CMHR.DATRPC},4);
MM:=Mid({CMHR.DATRPC}, 5,2);
DD:=Right({CMHR.DATRPC},2);

mlmcc
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:ansvarit
ID: 24153898
Apologies; upon double checking. The original field is a NUMBER field not a string. Thus the transformation to a STRING via the TOTEXT function.

mlmcc - When changing I get an error 'A String Is Required Here'.
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 1000 total points
ID: 24159146
Then the field isn't a text/string but a number

Since the default for ToText is to add 2 decimals and commas try it this way
20090101 converts to this string  20,090,101.00
The commas and decimal places cause the trouble

YY:=Left(ToText({CMHR.DATRPC},0,''),4);
MM:=Mid(ToText({CMHR.DATRPC},0,''), 5,2);
DD:=Right(ToText({CMHR.DATRPC},0,''),2);

mlmcc
0
 

Author Closing Comment

by:ansvarit
ID: 31570282
mlmcc - You're a gem. Issue resolved.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question