?
Solved

crystal reports selection formula and sql query in asp.net c#

Posted on 2010-01-06
3
Medium Priority
?
3,671 Views
Last Modified: 2012-05-08
i'm using crystal reports that comes bundled with visual studio 2005

im passing a selection formula to the crystal reports using the codebehind c# of asp.net
in this selection formula im passing a date range and a range of figures
how do i get to display this in the crystal report itself [on the rpt page] ?

also, after i finish designing the report using the wizard [form groups, add formulas, etc] ... during checking the sql query, i see the order by clause. i think this causes a lot of slow down while generating the report. is there any way to remove the order by clause?
0
Comment
Question by:RakeshBhandari
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
James0628 earned 2000 total points
ID: 26197338
I haven't used that version of CR, so I don't know what the designer is like, but the basic way to show a parameter on a report is just to drag and drop it on the report.  However, if the parameter accepts ranges or multiple values, that won't work.  For a parameter that accepts a single range, you can create formulas like the following and put those on the report:

// start date
Minimum ({?date parameter})

// end date
Maximum ({?date parameter})


 Or, you can get a little more sophisticated and do some formatting in a formula, like:

"From " + CStr (Minimum ({?date parameter}), "dd/MM/yyyy") +
 " to " + CStr (Maximum ({?date parameter}), "dd/MM/yyyy")


 Change the date formatting as you see fit.  Look for CStr in the CR Help to see a list of formatting codes.

 If your parameters allow multiple values, that gets more complicated.  You can see some example formulas to handle that kind of thing at:

http://www.kenhamady.com/form07.shtml


 As for the "order by" thing, if that's in your SQL query, I'm not sure that you want to get rid of it.  It's usually a good thing.  But if you do, you can see if you have a File > "Report Options" item in the designer.  If so, see if there is a "Use Indexes Or Server for Speed" option there.  If it's checked, you can try unchecking it and see what happens.  In a quick test I just did here using CR 10, that got rid of the ORDER BY clause that was in my SQL query.  But, like I said, that's usually something that you would _want_ sent to the server.

 James
0
 
LVL 2

Author Closing Comment

by:RakeshBhandari
ID: 31673865
thank you!
0
 
LVL 35

Expert Comment

by:James0628
ID: 26206409
You're welcome.  Glad I could help.

 James
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Integration Management Part 2
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month16 days, 17 hours left to enroll

864 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