cancel
Showing results for 
Search instead for 
Did you mean: 

Broken CStr function in Crystal Reports

kenneth_crawford
Explorer
0 Kudos

Hello Everyone,

I have a new weird issue.  I have a formula that has been working fine until yesterday.

The db I am querying is using a year month string to query a database.  So I created the following code to convert a calculated date into the string I needed.  It has been working fine until yesterday. 

Here is the code I am using

{?Date} = inputted date

{@Date.4} = calculated date

{@Date_4} = the string of yyyymm I need for the querry/

Formula "Date.4":  DATE (DateAdd ("m",-4 ,{?Date}))

Formula "Date_4":

if MONTH({@date.4}) < 10 then CStr (YEAR ({@date.4})) & '0' & CStr (MONTH ({@date.4})) else CStr (YEAR ({@date.4})) & CStr (MONTH ({@date.4}))

the formula is returning "2016.0003.00"

It used to return "201603" (and that is what I need)

Can you see why this might be returning the wrong values?

Accepted Solutions (1)

Accepted Solutions (1)

kenneth_crawford
Explorer
0 Kudos

I have broken down the values and found the issue is that the  'Year({@date.4})" =2016.00 and month is similar creating the decimal and two '00' - this is my problem.

kenneth_crawford
Explorer
0 Kudos

There was an option set that was adding the decimal for number fields.  I didn't look at this because it was a string.?.  It is fixed I think.?.

Answers (0)