ReportPro 3.9 and sql table swap
Posted: Thu Mar 24, 2022 4:19 pm
Hello, Robert.
If it helps, I'll send you a detail of the problems I've found in Report Pro 3.9.
1.- Substitution of Tables:
When creating a report where the tables must be replaced during the execution of a program, it does not generate any error in execution, but the tables are not replaced.
oReport:SetTableStringAttribute( 1, 'table.col', SQLTABLE_ATTR_TABLE, 'table1.col')
Therefore, in execution, it continues to use the tables with which they were used when designing the report.
2.- SQL from:
I have tried to do the substitution of tables from point 1, and use the SQL from to tell the report which are the new tables at runtime, but it doesn't work either.
oReport:SetTableStringAttribute( 1, 'customers.col', SQLTABLE_ATTR_TABLE, 'customers1.col')
oReport:SetTableStringAttribute( 1, 'invoice.col', SQLTABLE_ATTR_TABLE, 'invoice1.col')
oReport:SetTableStringAttribute(1, “DSN”, SQLQUERY_ATTR_SQL_FROM,
"customers1 left join invoice1 on (customers1.id = invoice1.id)")
3.- Report using 'where' and 'order by':
We create a report with 1 or more related tables. At run time, when we send a "where", mentioning the name of the table.column, an execution error is thrown.
"vendvtac.codigo=1 and vendvtac.date between '20220101' and '20220301'”
But if we remove it from the table name it runs fine:
"code=1 and date between '20220101' and '20220301'”
The same problem occurs when using the Order by command.
The problem with this situation is when there is more than one table in the report, and we must filter through multiple columns from different tables.
4.- Using 'printpreview':
In version 2.14 of the Report I use printpreview with the #rpPrintPreviewMDI parameter and each report is integrated into my systems as another window, thus being able to open various previews of different reports.
oReport:PrintPreview(“Title1”,,”Title2”,"Printing report ...",,,,#rpPrintPreviewMDI) //version 2.14
And I take control at the close of each window using the rpReportEnded(oRpReport) method.
In version 3.9 I can't find a way to do it, according to the manual, I should use the commands:
oReport:PreviewModal := FALSE //default TRUE
oReport:SetReportStringAttribute(RPT_ATTR_PREVIEW_MODAL, "N")
When using the 2 described commands, an error appears in execution, from VO, which says:
Error code: 50 [ACCESS VIOLATION] VO-CODE error 5333
Is it possible, in 3.9, to use the preview as I use it in 2.14?
I do not know if there are more problems since I have not used all the commands that version 3.9 has.
Thank you very much for the time spent.
Gerard
If it helps, I'll send you a detail of the problems I've found in Report Pro 3.9.
1.- Substitution of Tables:
When creating a report where the tables must be replaced during the execution of a program, it does not generate any error in execution, but the tables are not replaced.
oReport:SetTableStringAttribute( 1, 'table.col', SQLTABLE_ATTR_TABLE, 'table1.col')
Therefore, in execution, it continues to use the tables with which they were used when designing the report.
2.- SQL from:
I have tried to do the substitution of tables from point 1, and use the SQL from to tell the report which are the new tables at runtime, but it doesn't work either.
oReport:SetTableStringAttribute( 1, 'customers.col', SQLTABLE_ATTR_TABLE, 'customers1.col')
oReport:SetTableStringAttribute( 1, 'invoice.col', SQLTABLE_ATTR_TABLE, 'invoice1.col')
oReport:SetTableStringAttribute(1, “DSN”, SQLQUERY_ATTR_SQL_FROM,
"customers1 left join invoice1 on (customers1.id = invoice1.id)")
3.- Report using 'where' and 'order by':
We create a report with 1 or more related tables. At run time, when we send a "where", mentioning the name of the table.column, an execution error is thrown.
"vendvtac.codigo=1 and vendvtac.date between '20220101' and '20220301'”
But if we remove it from the table name it runs fine:
"code=1 and date between '20220101' and '20220301'”
The same problem occurs when using the Order by command.
The problem with this situation is when there is more than one table in the report, and we must filter through multiple columns from different tables.
4.- Using 'printpreview':
In version 2.14 of the Report I use printpreview with the #rpPrintPreviewMDI parameter and each report is integrated into my systems as another window, thus being able to open various previews of different reports.
oReport:PrintPreview(“Title1”,,”Title2”,"Printing report ...",,,,#rpPrintPreviewMDI) //version 2.14
And I take control at the close of each window using the rpReportEnded(oRpReport) method.
In version 3.9 I can't find a way to do it, according to the manual, I should use the commands:
oReport:PreviewModal := FALSE //default TRUE
oReport:SetReportStringAttribute(RPT_ATTR_PREVIEW_MODAL, "N")
When using the 2 described commands, an error appears in execution, from VO, which says:
Error code: 50 [ACCESS VIOLATION] VO-CODE error 5333
Is it possible, in 3.9, to use the preview as I use it in 2.14?
I do not know if there are more problems since I have not used all the commands that version 3.9 has.
Thank you very much for the time spent.
Gerard