Skip to Content
0
Jul 20, 2016 at 05:21 PM

Broken CStr function in Crystal Reports

468 Views

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?