Inherited reports and persistensein database
danni
Denmark
Hi,
I have been looking at the inherited part of the designer - creating / loading reports using the inherited function.
My setup:
I have implemented the 4 open and save events in the environmentSettings control, so data is saved and loaded through the SaveToString /LoadFromStringmethods and posted to a database.
1. I create a report with a Test: "header" in the pageheader and a text: "Footer" in the pagefooter. Not using the datasource at all.
2. Save the base report to the database.
3. I create a new report using the "new inherited report" function.
NOW... when I see the report I should see the items from the base report, correct? Or am I mistaken? I have a feeling that the base reprot is not loaded at all when creating an inherited report.
How can I fix this you recon?
Thank you
I have been looking at the inherited part of the designer - creating / loading reports using the inherited function.
My setup:
I have implemented the 4 open and save events in the environmentSettings control, so data is saved and loaded through the SaveToString /LoadFromStringmethods and posted to a database.
1. I create a report with a Test: "header" in the pageheader and a text: "Footer" in the pagefooter. Not using the datasource at all.
2. Save the base report to the database.
3. I create a new report using the "new inherited report" function.
NOW... when I see the report I should see the items from the base report, correct? Or am I mistaken? I have a feeling that the base reprot is not loaded at all when creating an inherited report.
How can I fix this you recon?
Thank you
Comments
You need to implement the report.LoadBaseReport event.
I have implemented the environmentSettings_CustomOpenDialog and environmentSettings_CustomOpenReport evnet.
This is where I add the event, but the event is never called when I press newInheritedReport.
// wire up event
e.Report.LoadBaseReport += new CustomLoadEventHandler(CurrentReport_LoadBaseReport);
// load the main report
e.Report.Load(...);
// unwire event
e.Report.LoadBaseReport -= new CustomLoadEventHandler(CurrentReport_LoadBaseReport);
It is when i want to create a new inherited report.
when i create a new inherited report the only event thats beeing called is the event environmentSettings_CustomOpenDialog.
the eventhandler environmentSettings_CustomOpenDialog, should know if its a basereport or just a normal report thats beeing opened. SO i can call loadReport or loadBaseReport. But I cannot see how its can done.
I've tried to do the same, and the event is called. Could you make a simple demo for me?
For example, if I modify the Demo.exe source in the following way:
I see that the event handler is called when I do "New inherited report".
I have made a fast example where I have done the following:
1. added the designer control to a form.
2. added environments to the designer and oimplemented the open/save methods with a simple messagebox only.
3. added a loadbaseReport event to the designer.report in the Form.Load evnethandler
The message "loadignbaseReport..." is never shown.
Modify the code in the following way, and the LoadBaseReport event will fired:
I use the e.Data Property in the openDialog handler to provide the reportID from the database into the custon openReport. But I will try using the filename insted ans see what happens.
Thank you :-)
1. If i specify a "dummy" filename. The designer throws a FileNotFoundException.
2. if I specify the report ID from the database as filename I get an invalid fileformat
I add the following: e.Filename = 14 + "";
Then I get the error below.
Is there a property I need to set to ignore true filenames in the "e.Filename"?
Looks like I need another test project from you
BUT when i use id's to a database and save/load reports to a string it fails.
Try use an id insted of a filename.
I had this beautifull line except it looked like this (uncommented) he he
//designerControl.Report.LoadBaseReport += new CustomLoadEventHandler(Report_LoadBaseReport);
Now I can create a new inherited report.
Next: [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> I cannot save the report. How do I do that? my report.BaseReport is "14" - the id of the baseReport, which is great. thank you for your patience with me[/img]
please include the load/save with inheritance aswell. Thats the only problem I have left in the designer apart from a few restrictions in the designer :-)
I have no problem saving the report but when i open it again i have no small locks on the fields from the inherited report. As if I loose the conenction with the basereport when I save it to the database.
Back from summer holidays.
Can I pass an ID from a report in my database as e.Filename in report_LoadBaseReport now?
I'm not too sure how to load the base and inherited report when storing reports in a database.
Thanks
Please look at the C#\Demos\CustomOpenSaveDialogs demo. It does exactly what you need (in fact, this demo was written for you
I have used your example against the xml file. Iit works very well against databases now.
Thanks! :-)