?
Solved

Editing Subreport SQL Query at Runtime

Posted on 2002-03-07
3
Medium Priority
?
1,182 Views
Last Modified: 2008-03-04
Hi Guys,

In crystal 8.5, is there a way to edit the subreport's query at runtime? I wanted to edit/modify the WHERE clause of the subreport's SQL query.
Is this thing can be done? If it's possible, can you please show me a Delphi code on how to do this.
I'm using MSSQL 2000.

TIA,
zero

0
Comment
Question by:zerobro
[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
3 Comments
 
LVL 4

Accepted Solution

by:
jrmn earned 400 total points
ID: 6846816
Hi zerobro,

You have to first point the Crystal VCL to the particular Subreport and then read/write the SQL Query property:
 
Crpe1.ReportName := 'c:\test.rpt';
Crpe1.Subreports[1];
Crpe1.SQL.Clear;
{Build the Query}
Crpe1.SQL.Query.Add('WHERE DEPT."DEPTNO" = 10');
Crpe1.SQL.Query.Add('ORDER BY DEPT."DNAME" ASC');
{Remember to set the component back to the main Report}
Crpe1.Subreports[0];
Crpe1.Show;
 
If you want to retrieve the Query you have to call the Retrieve method first.  This is one of the only classes in the new Crystal VCL that still retains a "Retrieve" function.  The reason for this is explained in the UCrpe32.hlp (Help) file.

You should just edit the WHERE clause.  Leave the SELECT and FROM as they are in the Report just like in the crystal reports designer.

Goodluck,
jrmn

0
 

Author Comment

by:zerobro
ID: 6846824
hi jrmn

Thanks for the help...your suggestion solved my problem.

zerobro
0
 

Expert Comment

by:yas1891
ID: 7377771
Hi,
Do you know how i can use runtime data selection in delphi, would you please show me this by Delphi code ?

when i am trying to do this
Crpe1.ReportName:='test.rpt';
Crpe1.Tables[0].DataPointer:=CrpeDs.DataPointer;
Crpe1.Show;

i face to this message Error 553 : PeSetNthTablePrivateInfo ...

Please let me know how i can solve it.
Cheers,
Yas
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

771 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