Solved

URGENT! Crystal Caching Parameters

Posted on 2004-08-16
4
172 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
ID: 11836856
What Version of crystal?
0
 
LVL 18

Author Comment

by:Plucka
ID: 11837135
9 ras
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 11848788
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
ID: 11849316
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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

856 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