Page 1 of 2

Reports from Assemblies

Posted: Wed Oct 08, 2008 9:13 pm
by Milton Guevara
Hello
I'm using reports in dll (assemblies) in my programs, i use the following code in VB to load the report:

factura = StiReport.GetReportFromAssembly(My.Application.Info.DirectoryPath & "\Reportes\Formatos\boleta.dll")
factura.RegData(facturaDataSet)
factura.Print(False)

When i upgrade to a new preleased, i get the following error: "Unabled to load one or more of the requested types. Retrieve the LoaderExceptions property for more information"

This is solved recreating the report as assemblie ("save reports as").
Any idea of how can i make to avoid this manual and the update is transparaente?

Thanks

Milton Guevara


Spanish
Hola
Estoy usando reportes en dll (assemblies) en mis programas, utilizo el siguiente codigo en VB para cargar el reporte:
factura = StiReport.GetReportFromAssembly(My.Application.Info.DirectoryPath & "\Reportes\Formatos\boleta.dll")
factura.RegData(facturaDataSet)
factura.Print(False)

Cuando realizo una actualización a un nuevo preleased, me aparece el siguiente error: "Unabled to load one or more of the requested types. Retrieve the LoaderExceptions property for more information"

Esto se soluciona volviendo a crear el reporte como assemblie ("save reports as").
Alguna idea de cómo puedo hacer para evitar este cambio manual y la actualización sea transparaente ?


Reports from Assemblies

Posted: Thu Oct 09, 2008 12:28 am
by Vital
Hello Milton,

You can use following code:

Code: Select all

StiReport report = new StiReport();
report.Load(file);

string folder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
folder = Path.Combine(folder, "Stimulsoft\\CompiledReports");
folder = Path.Combine(folder, System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion().ToString());
string compiledReportFile = Path.Combine(folder, report.GetReportAssemblyCacheName());

					
if (File.Exists(compiledReportFile))
{
	report = StiReport.GetReportFromAssembly(compiledReportFile, true);
	report.RegData(dataSet);

	report.Render();
}
else
{
	report.RegData(dataSet);						
	if (!Directory.Exists(folder))Directory.CreateDirectory(folder);

	report.Compile(compiledReportFile);
			
	report.Render();
}
					
if (!report.IsStopped)
{	
	report.Show();
}
Thank you.

Reports from Assemblies

Posted: Thu Oct 09, 2008 11:56 am
by Milton Guevara
Vital, thank you for your answer, i have some consultations:

1. The problem reported occurs in two situations: when do i update my application to a new version and also when do i update Stimulsoft to a new version. ¿ is this code addresses both cases?

2. The folder "Stimulsoft\\CompiledReports" will keep reports compiled old, will grown indefinitely or deleted automatically?

3. When you modify a report the code also will detect the change and recompile?

Thank you

Spanish:
Vital Gracias por tu respuesta, tengo algunas consultas:

1. El problema reportado ocurre en dos situaciones: cuando yo actualiza mi aplicación a una nueva version y tambien cuando actualizo Stimulsoft a una nueva version. ¿ Este codigo soluciona ambos casos ?

2. La carpeta "Stimulsoft\\CompiledReports" mantendrá reportes compilados antiguos, ¿ crecerá de forma indefenida o se eliminan automaticamante en algun momento ?

3. Cuando modifico un reporte, ¿ el codigo detecta el cambio y recompila ?

Reports from Assemblies

Posted: Thu Oct 09, 2008 5:11 pm
by Vital
Hello Milton,
1. The problem reported occurs in two situations: when do i update my application to a new version and also when do i update Stimulsoft to a new version. ¿ is this code addresses both cases?
If you update Stimulsoft - yes, if you update your application - no. But you can add version of your application to GetReportAssemblyCacheName. For example:
GetReportAssemblyCacheName() + myVersionNumber;
2. The folder "Stimulsoft\\CompiledReports" will keep reports compiled old, will grown indefinitely or deleted automatically?
You need add code to delete old reports.
3. When you modify a report the code also will detect the change and recompile?
Yes, this code automatically create new assembly for report.

Thank you.


Reports from Assemblies

Posted: Thu Oct 09, 2008 5:34 pm
by Milton Guevara
Vital

OK, this all clear.
Thank you for your support.

Milton

Reports from Assemblies

Posted: Thu Oct 16, 2008 4:07 pm
by tammamkoujan
Hi
i faced the same problem
also when i use the reports designer to create a report from business object i cannot create a data source using a business object because create new data source
show empty dialog,
and when i open a report created with the an older version of stimulsoft reports.net i cannot compile this report and it show disconnected data source .
All of that was working in the previous version.
Please advice.

Reports from Assemblies

Posted: Tue Oct 21, 2008 1:50 pm
by tammamkoujan
up

Reports from Assemblies

Posted: Tue Oct 21, 2008 5:08 pm
by Edward
Hello.
i faced the same problem
also when i use the reports designer to create a report from business object i cannot create a data source using a business object because create new data source
show empty dialog,
and when i open a report created with the an older version of stimulsoft reports.net i cannot compile this report and it show disconnected data source .
All of that was working in the previous version.
Please advice.
But above you can find a solution for the problem as well. If you still in doubt about possible solution, please send a sample project which illustrates the problem to support[at]stimulsoft.com for analysis and we would help you.

Thank you.

Reports from Assemblies

Posted: Wed Nov 05, 2008 10:59 pm
by tammamkoujan
i am talking about "when i use the reports designer to create a report from business object i cannot create a data source using a business object because create new data source
show empty dialog,
and when i open a report created with the an older version of stimulsoft reports.net i cannot compile this report and it show disconnected data source .
All of that was working in the previous version."

in an older version i was creating the reports from business object very easy now i did not know why i cannot.



Reports from Assemblies

Posted: Thu Nov 06, 2008 7:40 pm
by Vital
Hello,

Please try to call "Synchronize" function from Report Dictionary in "Actions" menu.

Thank you.