Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

URGENT! Crystal Caching Parameters

Posted on 2004-08-16
4
Medium Priority
?
181 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 101

Accepted Solution

by:
mlmcc earned 2000 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

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
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.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

618 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