Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Help with formula/determining proper values needed Post Reply Post New Topic
<< Prev Page  of 2
Author Message
gphreak
Newbie
Newbie


Joined: 14 Mar 2007
Online Status: Offline
Posts: 17
Quote gphreak Replybullet Posted: 10 Apr 2007 at 12:51pm
I will. Is there an example anywhere on how to load those values from SQL queries?
I start off with a parameter that has no default values. SQL populates a listbox of default values. I need to load those values from the listbox as parameter default values. I then select multiple values from the listbox and reload the report, which passes the selected values to the report and that's it. It all sounds quite straightforward, but without an example it may not be so simple.

How would one do it using formulas? The reasons I ask are these:
1. Would a selection formula not require the loading of all data and then filtering the data? Is that not too much on the server?
2. If one needs to select all or just specific items from the table as criteria, how does one express all items or an arbitrary list of items to be passed into the selection formula?

Is there an example of doing something similar using just formulas?

Thanks!


IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 10 Apr 2007 at 1:33pm
I don't know of any online samples for all this. I have some code in my book but not enough to walk you through all the steps you. That MSDN link you posted looked pretty good. That should get you through most of the logic.

CR has many rules for when to filter the data itself or when to pass it through to the database. First you need to get the project working and then you can look at performance issues. I would say that since you have lots of parameters then it might try to filter locally. But again it just depends (I have various rules of thumb listed in my book, but all you have to do is just look at the SQL Query to see what it is doing).
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
gphreak
Newbie
Newbie


Joined: 14 Mar 2007
Online Status: Offline
Posts: 17
Quote gphreak Replybullet Posted: 10 Apr 2007 at 2:59pm
OK, I am getting somewhere with formulas... How can I print a value passed into a formula on the report? Formula contains a date that the user inputs, so how would I display on the report something like "Inventory date: " <specified date>?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 10 Apr 2007 at 3:12pm
Just drag and drop it onto the report where you want it to appear.

But to be honest, if you aren't familiar with that then you need to go to my free online chapters and read about report objects and the basics of how they work. You are going to have LOTS of questions otherwise. (I'm happy to help out, but when I have a whole book online for free then don't pass up the good info).
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
gphreak
Newbie
Newbie


Joined: 14 Mar 2007
Online Status: Offline
Posts: 17
Quote gphreak Replybullet Posted: 10 Apr 2007 at 3:32pm
Oh, I know there's whole bunch to learn. And I did buy your book, BTW Smile it's just that I am in a serious lack of time. However, the date from selection formula comes from code, not the designer. I know that within the designer I can drag and drop stuff but this comes from the code.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 10 Apr 2007 at 3:41pm
You have to add a formula to your report with a dummy date value and drop that onto the report. Then from your application override the dummy date value with the actual date value. See page 317-318 for more info. Oh yeah - pass it as a CDate() function (I need to add a good example to the next edition).
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
gphreak
Newbie
Newbie


Joined: 14 Mar 2007
Online Status: Offline
Posts: 17
Quote gphreak Replybullet Posted: 10 Apr 2007 at 5:19pm
Well, I managed to make some progress even with parameters and live SQL queries. Just to throw it out there, I ran into a problem when the number of default values I tried to assign was above 1000, I got an error saying that SQL Query was too complex.
Clearly, I do not necessarily need 1000+ default values, but since Brian suggested I post any discoveries, well, there's one.
I don't know whether it's VS2005 CR or CR in general, or simply my code, but that is what I have found out.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 10 Apr 2007 at 11:22pm
Hmmm. Depends on where the error is happening. When you are posting to SQL or when you are updating the report parameter collection.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
gphreak
Newbie
Newbie


Joined: 14 Mar 2007
Online Status: Offline
Posts: 17
Quote gphreak Replybullet Posted: 11 Apr 2007 at 12:44am
Actually, now that you mentioned it, it happens when updating the parameters. What I have is a button that selects all items in the listbox of values returned from initial query. So, I will need  to figure out a user-friendly way to limit those parameter updates and then I should be good. With a lot of help from you and MSDN, the code seems to be working, at least on the sample data.
IP IP Logged
<< Prev Page  of 2
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.000 seconds.