SaveReportAs - cDRReport¶
Methods - Properties - Events
Method Type¶
Procedure
Return Type¶
None
Arguments¶
| Argument | Description |
|---|---|
sReportID |
ID of a report. Must be ID of a report. This argument can be passed as an empty string. The empty string can be written as C_USEMAINDRREPORTID. |
sFileName |
The name of a NEW file. |
Description¶
Saves the definition of the currently loaded report to disk. This means that, for example, the connection string of a report can be changed and saved to disk, making it easier to open the report in a DataFlex Reports Studio installation at the customer location.
The sFileName MUST be a NEW file. It is not possible to overwrite an existing file. No error is given when an existing file is found.
This method cannot be used before the report OCX object is initialized. The COM object creation is performed as part of the OpenReport method if it has not been done beforehand.
DataFlex Framework usage¶
- Web
- Windows
- FlexTron
Sample¶
Object oReport is a cDRReport
Set psReportName to 'MyReport.dr'
End_Object
Object oSaveReportButton is a Button
Set Label to 'Save Report'
Procedure OnClick
String sReportId sDatabaseConnection sServer sReportsFolder sReportName
Integer iDriver
Get OpenReport of oReport to sReportId
If (sReportId <> '') Begin
Get psDatabaseConnection of oReport sReportId to sDatabaseConnection
Get DriverIndex Of ghoConnection "MSSQLDRV" to iDriver
Get_Attribute DF_DRIVER_SERVER_NAME of iDriver 1 to sServer
Move (Replace ('SERVER=(local)', sDatabaseConnection, 'SERVER=' + sServer)) to sDatabaseConnection
Set psDatabaseConnection of oReport sReportId to sDatabaseConnection
Get ReportsFolder Of oReport to sReportsFolder
Get psReportName of oReport to sReportName
Move ('Copy of' * sReportName) to sReportName
Send SaveReportAs of oReport sReportId (sReportsFolder - sReportName)
End
End_Procedure
End_Object