Solved

URGENT! Crystal Caching Parameters

Posted on 2004-08-16
4
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Don't miss ATEN at NAB Show April 24-27!

Visit ATEN at NAB Show to learn how our "Seamlessly Entertaining" solutions deliver fast, precise video streaming without delays for the broadcasting and media environment. ATEN will showcase its 16x16 Modular Matrix Switch (VM1600) and KVM Over IP Solution (KE6900 series).

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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