I have the following setup:
- Delphi 5 Enterprise Update 1 Crystal
- Reports Developer XI Rel2 (RDC 11.5)
After long hours of trial&error I can now set the logon stuff as asked earlier but when I try to set crystal parameters by code - it does not work and I get an empty report.
I've written a small app for testing (here's just a snippet):
for i:=1 to FParamFldDefs.Count do begin
FParFldDef := FParamFldDefs.Item[i];
FParFldDef.ClearCurrentValueAndRange;
if ParFieldName = 'User' then
FParFldDef.AddCurrentValue('hugo')
else if ParFieldName = '@P_Date' then
FParFldDef.AddCurrentValue('2009.06.30')
if FParFldDef.IsDefaultValueSet then
ShowMessage('DefaultValue: ' + FparFldDef.GetNthDefaultValue(1));
//--> on loop 1 i=1 this does not show up because IsDefalutValueSet = FALSE
//--> on lopp 2 i=2 this does show '2009.06.30'
if FParFldDef.IsCurrentValueSet then
ShowMessage('CurrentValue: ' + FparFldDef.GetNthCurrentValue(1));
//--> on loop 1 i=1 this does show 'hugo'
//--> on lopp 2 i=2 this does not show because IsCurrentValueSet = False
end;
ShowMessage(FldDef.SQLQueryString); //this shows all
//stored procedure parameters empty
Now I've managed to have the CurrentValues set (had to save the report in question with version 11 - it was version 9 before) because IsCurrentValueSet returns True but when I try to read the SQLQueryString I can see that all SP parameters are NULL. Any Ideas on that?
The format of the date value might be a problem. Have you tried using 07/02/2009 or 07/02/2009 12:00 AM?
I've seen the light! If someone like me ever gets forced to deal with Delphi 5 and Crystal XI RDC - here's what I've done:
Prerequisites:
Firs of all, you have to:
After you've done that you can use Joseph Styons wrapper class and you're just fine. If you too have a report which gets it's data from a SQL Stored Procedure just set those parameters (their names start with an "@") like any other Crystal Parameter.
That's it, I'll hope this is usefull to somebody.
Now I'm off for some beer!
Cheers, Reinhard