Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: SQL Problems Post Reply Post New Topic
Author Message
OKsoccer24
Newbie
Newbie


Joined: 05 Jun 2008
Online Status: Offline
Posts: 35
Quote OKsoccer24 Replybullet Topic: SQL Problems
     Posted: 08 Jun 2009 at 8:19am
Here is the command  I am  using to get my data.

select *
from events
where
year_month >= (select (max(cast(year_month as nvarchar))-99) from events)

This runs fine as long as there are no parameters in my report, but I need a parameter that selects the application field so I can only see data for that application.  I want to have a prompt to have all the available applications to choose from the table, but when I do I only get between 4 to 8 applications available when I should have 128.  Any reason why Crystal is being dumb?  
IP IP Logged
OKsoccer24
Newbie
Newbie


Joined: 05 Jun 2008
Online Status: Offline
Posts: 35
Quote OKsoccer24 Replybullet Posted: 08 Jun 2009 at 8:30am
I also would like to state that I have ran it with just select * from events with no where and it still does not work.  Also when you run it have put everything in the details, it does show everything, but when you browse data on application is only shows four there when I can clear see that it have a lot more of that.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 09 Jun 2009 at 6:20am
Hmm...you should be able to create a command that will select your applications.
 
for the most flexibility, I would say create a stored proc that takes a parameter.
 
It looks like you are using the Command function to select the data for your report.  In which case what you are looking to do is going to be difficult.  While no one has denied it, no one has confirmed it either, but I don't believe that the Command object was intended to gather data directly for the report.  I believe that it was created to gather dynamic data from the database to be used in the selection of parameters for a report.  As such, a stored proc is the way to go.
 
If you want to use the report as structured, I would create a command that selects all applications and place them in a parameter.  Then in the Report/Select Formulas/Records I would place a filter on the data for the application selected as a parameter.
 
HTH
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 09 Jun 2009 at 6:21am

As a further note, while there might be lots of applications, it may be that there are only a few being used in your events table.  At least that meet your date requirement.

IP IP Logged
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