Skip to Content
Former Member
Dec 05, 2008 at 08:27 PM

Forcing API to keep parameter as String.


Hi again..

I recently made a post about having difficulties with the Date type parameter (llegalArgumentException when trying to schedule report w/ Date param(s)) not being accepted as a valid parameter.

Ted Ueda was nice enough to post a solution to that (using Date(...)) in the setValue method but unfortunately that turned me onto the actual problem.

Once I sent the report a Date parameter it continued to error and further investigation has shown that the report actually expects a String for a date... the report parses it. The report expects a String in the format of yyyyMMdd and it handles the conversion from there.

At first I was very confused by this because of course I was setting a String in the java api of value "20081011". I believe what might be happening is that the API seeing that the String is just numbers is converting it to some other datatype... then when it arrives at the report an error occurs because it is expecting a String and not a Number.

So my question is basically... is there a way to force this parameter to remain a String? I've tried "String(yyyyMMdd)" and various other things but I've yet to find anything that works 😔

Below is the error that is returned from the crystal server when trying to pass "Date(2008,10,11)" as a parameter:

Error in formula <dayRange>.

'MonthName(ToNumber(Mid({?prm_txt_startDate_1}, 5,2))) + " " + ToText(ToNumber(Right({?prm_txt_startDate_1}, 2)), 0) +

The string is non-numeric.

Details: errorKind

Thanks again for the help with the previous problem and for any advice anyone can provide for this situation.