09-08-2009 06:23 AM
Solved! Go to Solution.
09-08-2009 06:56 AM
09-08-2009 09:45 AM
09-10-2009 06:00 AM
Thanks Mike. Again you are a life saver. I had this on my "list of things to do" and now I don't need to. My temp workaround was just to re-release the old scripts, but your solution is MUCH better. Again, thanks for saving me a lot of work.
09-10-2009 06:29 AM
03-10-2010 05:16 AM
my users came up with a quiet complex report they want to preview by clicking an icon from the toolbar (not manouvering to reports, select report, current record, preview and so on). The Report itself is loaded with numbers of subreports (like "10 latest History Records", which I couldn't manage reliably in Crystal) so they are based on linked in SQL Views, scripted to the remote clients via osql -i<file doing view.sql> fired in Admin as a Remote Task).
So far so good but how to achiev?
I spent quite some time to pull all the bits and pieces from several posts and docs... and here we go:
I've dev'd this 4 step "recipe":
1. Create Report
2. Create 1st Active Script
3. Create 2nd Active Script
4. Create Toolbar
Save Project and create Bundle (ALLLLL!!! on a Test System of course) to port it to Production later.
1. Ceate Report:
Most important is to place the Keyfield in the Report to manage filtering, obviously. In my case ACCOUNT:ACCOUNTID
2. Create 1st Script
This is a Script populating the CurrentAccountID into a global Var.
dim wpeAccID, g_wpeAccID
wpeAccID = Application.BasicFunctions.CurrentAccountID
Application.BasicFunctions.GlobalInfoSet "g_wpeAccID", wpeAccID
Application.BasicFunctions.DoInvoke "CrystalReportPreview", "ACCOUNT:Report you created"
Save the Script as "Set CR global AccountID" or so. Will be needed later for the icon in the toolbar.
3. Create 2nd Script
This Script will pass the Filter Condition to the CR
wpeCRID = Application.Basicfunctions.GlobalInfoFor("g_wpeAccID")
if wpeCRID <> "" then
Application.BasicFunctions.ReportAddCondition "ACCOUNT:ACCOUNTID", "=", wpeCRID, "String", ""
Save the Script as "Launch CR with Filter" or so
Now in Architect go to Manage -> Reports and double-click your Report.
On the Execution tab put this script on the when open event.
4. Create Toolbar
Now create a Toolbar and put "Standard Toolbar" as a Child, then "Your Report Name" as Child hereunder.
- Merge Rule: After Previous
- Select a funky glyph
- Action: Active Script.
- Argument: Personalet CR global AccountID
Put all the pieces in a bundle and don't forget the releases...
Hope that helps - any comments?