Solved

URGENT! Crystal Caching Parameters

Posted on 2004-08-16
4
169 Views
Last Modified: 2013-12-24
Hi,

Using Coldfusion i'm calling a report that is run so frequently that i'm keeping the object open.

               if (Not StructKeyExists(Application, Attributes.Persist)) {
                    Application[Attributes.Persist] = StructNew();
                    Application[Attributes.Persist].o_CrystalReport = CreateObject('component', '#Application.DbSource#.nuReport');
                    Application[Attributes.Persist].o_CrystalReport.Init(Application.DbServer);
                    Application[Attributes.Persist].o_CrystalReport.OpenReport(Attributes.Report,'rassdk://');
                    Application[Attributes.Persist].o_CrystalReport.SetDatasource(Application.DBSource,Application.DbServer,Application.DbUser,Application.DbPass);
               }
               Application[Attributes.Persist].o_CrystalReport.RunReport(5,'#GetPrinter.Path##Attributes.JobId#',Attributes.Parameters);

So the only bit that gets run more than once is the last line which just calls the report which will already be open. The problem that i'm having is the report is always run with the set of parameters that were first passed, even though im passing the parameters on this line, theres a couple of sub functions, but here's the bit of code that sets the parameters, can anyone tell me how to replace the existing parameters.

               for (i=1; i lte ListLen(Arguments.parameters); i=i+1)
               {
                    result = ListgetAt(Arguments.parameters,i);
                    ParamCollection = getClientDoc().DataDefinition().ParameterFields;
                    ParamToChange = ParamCollection.Item(i-1);
                    NewValue = GetFactory().CreateObject("CrystalReports.ParameterFieldDiscreteValue");
                    NewValue.Value = result;
                    TempParam = GetFactory().CreateObject("CrystalReports.ParameterField");
                    ParamToChange.CopyTo (TempParam);
                    TempParam.CurrentValues().Add(NewValue);
                    ParamController = getClientDoc().DataDefController().ParameterFieldController();
                    ParamController.Modify (ParamToChange, TempParam);
               }
0
Comment
Question by:Plucka
  • 2
4 Comments
 
LVL 1

Expert Comment

by:slushe
Comment Utility
What Version of crystal?
0
 
LVL 18

Author Comment

by:Plucka
Comment Utility
9 ras
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
Comment Utility
I believe (from my experience with VB) you need to fully close the report and the viewer to pass new parameters.  The only other idea I have would be to add a line like
crReport.DiscardSavedData or force a refresh of the viewer.

mlmcc
0
 
LVL 1

Expert Comment

by:slushe
Comment Utility
I thought this over and decided I'm rusty on using the RDC, it's been a good year.  Do you have access to the Technical Developer's guide?  It has great resources on it.  Crystal's site has some great ASP examples which you can pretty well copy line for line.  

My Crystal development project unfortunately came with paid for tech support by the client, so I simply called them for any strange issues and let them sweat over it.  I did however, learn how incredibly deep and invaluable their knowledgebase is.  

mlmcc has a great suggestion.  I don't remember offhand, but there are a few commands for initializing the report, it's values, etc, that you can use at different times.  The answer is definitely out there, especially for a product as widely used as CR.

Best of luck,
sl
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now