Crystal Reports Record Selection

pima

New Member
Hi everybody!

We (our comany) have decided to change from Progress ReportBuilder to Seagate Crystal Reports v9. Now I tried to implement the Crystal Reports API into our application.

This is my Code:

DEFINE VARIABLE crApplication as COM-HANDLE NO-UNDO.
DEFINE VARIABLE crReport as COM-HANDLE NO-UNDO.

CREATE "CrystalRuntime.Application.9":U crApplication.

crApplication:LogOnServer ("pdsodbc.dll", "HyperSped32", "", "user", "password").


ASSIGN crReport = crApplication:OpenReport(cReportFile,1).

crReport:DiscardSavedData.

crReport:SetReportVariableValue("FakturaNummer", STRING(Faktura.FakturaNummer)). <--- HERE IS THE ERROR


crReport:SelectPrinter("",cPrinterName,"").
crReport:printerSetup(0).

crReport:printOut(FALSE).


All of the above written lines/methods work fine, exept the SetReportVariableValue. I alwas get the following error:

"This value is write-only"
Error Code 0x80020009 USER-INTERFACE-TRIGGER exe\fakt (5890)

I've also tried to modify the RecordSelectionFormula, but there is also an error. If changed the line above to:

crReport:RecordSelectionFormula(cVariable),

where cVariable contains: "{Faktura.FakturaNummer} = 115434", e.g.

When i run the procedure now, after that change, i get the error:

"Listing is not supported" <-- I don't know the exact Phrase, because this Error-Message is in German.


My Progress version is 9.1C27 with Crystal Report 9 Advanced on Windows 2000 and Windows XP.


I hope somebody can help me.


[Sorry for my English :awink: ]


Marcus.
 

thesfinx

New Member
This is how I do it

FUNCTION setRecordSelection RETURNS LOGICAL
( ipcFormula as character ) :

/* Reset */
chRpt:RecordSelectionFormula = ''.
chRpt:ReadRecords().

if ipcFormula = '' then
return true.

/* Set the formula and read records */
chRpt:RecordSelectionFormula = ipcFormula.
chRpt:ReadRecords().

return true.

END FUNCTION.
 
Top