Solved

URGENT! Crystal Caching Parameters

Posted on 2004-08-16
4
170 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

896 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

19 Experts available now in Live!

Get 1:1 Help Now