Announcements
 Crystal Reports Forum : General Information : Announcements
Message Icon Topic: How To Use Maximum Formula Post Reply Post New Topic
<< Prev Page  of 2
Author Message
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 04 Jan 2008 at 4:19am
Sorry, I was responding to your earlier post before.

I honestly don't know whether or not you could join two different stored procedures with different parameters together.  I don't see why it would necessarily fail, off hand.  But, I expect there would be some weird behavior until you got all the bugs ironed out.

As a better solution, assuming you don't need the two stored procedures to interact very much, is to use subreports.  Put each stored procedure in a separate subreport.  Link the parameters to parameter fields in the main report.  That should do the trick.  If you do need to do something like compare totals, you can use shared variables.


IP IP Logged
trupu k
Newbie
Newbie
Avatar

Joined: 26 Oct 2007
Location: India
Online Status: Offline
Posts: 10
Quote trupu k Replybullet Posted: 06 Jan 2008 at 2:19pm
i have used cross tab but problem is its display format. i cant add line between two column. in custom format i saw that these lines are there but reports does not show this line.

big prob is
i want "NA" to be displayed if data is null How can i do this, becoz of this prob i used datatype of Curr_rain as string in database but in cross-tab it not giving correct value of any function used(ex. maximum) so i converted it to number but if data is null i want to display "NA" in report.


Plz Help me
Plz reply
tru
IP IP Logged
trupu k
Newbie
Newbie
Avatar

Joined: 26 Oct 2007
Location: India
Online Status: Offline
Posts: 10
Quote trupu k Replybullet Posted: 06 Jan 2008 at 2:27pm


thanks to reply.
i got upto this.
but now my bos want this report for many station included in one report.

if my db contains fields as
project_id char(5)
Station_id char(5)
date1      datetime
time1      datetime
today_rain int
total rain int

now i want to show rep as

            station1    Station2  station3
date time today total today total today totl


like this i want to data of each station in vertical format. there can be max 20 stations.


i thought to group by stationID
but this shows data as

station1
station2
station3

means in row format after completing data of one station, below that data of 2nd station


i used command1 as
select * from table where station_id=station1
& command2 as
select * from table where station_id=station2

& added this to crystal report but my data is huge i want to show 3000 record of one station at a time.
like this 3000 * 20(each 20 station data at a time using 20 commands)

this take so much time so i rejected this idea

now i used stored procedure.
in stored procedure i passed one parameter station_id so that i can use same stored proc for 20 station.

but when i add one stored proc to report it is ok
but when i add same proc sacond time  then it ask for creating alias for previous one,i told yes.

but when stored proc ask for parameter it take same parameter to both alias & original but i want 2 separate parameter as Station1 & station2 for both .

i want to use same stored proc for 20 station using diff parameter.
Plz help me for this,
plz told me if u have another solution
thanks


i have used cross tab but problem is its display format. i cant add line between two column. in custom format i saw that these lines are there but reports does not show this line.

big prob is
i want "NA" to be displayed if data is null How can i do this, becoz of this prob i used datatype of Curr_rain as string in database but in cross-tab it not giving correct value of any function used(ex. maximum) so i converted it to number but if data is null i want to display "NA" in report.

tru
IP IP Logged
trupu k
Newbie
Newbie
Avatar

Joined: 26 Oct 2007
Location: India
Online Status: Offline
Posts: 10
Quote trupu k Replybullet Posted: 06 Jan 2008 at 2:29pm
but i dont want to show subreports. how can i avoid that
tru
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 07 Jan 2008 at 5:16am
Originally posted by trupu k

i have used cross tab but problem is its display format. i cant add line between two column. in custom format i saw that these lines are there but reports does not show this line.

big prob is
i want "NA" to be displayed if data is null How can i do this, becoz of this prob i used datatype of Curr_rain as string in database but in cross-tab it not giving correct value of any function used(ex. maximum) so i converted it to number but if data is null i want to display "NA" in report.


I'm not sure what you mean "add line."  Do you mean a blank column?  A thicker gridline?  There are a lot of ways to customize your cross-tab.

Returning "NA" is going to be very difficult.  Crystal is really going to balk at mixing numbers and strings.  A much simpler solution, that may work for you, is to have null values default to 0 (the standard action in Crystal), and set the formatting option to display 0 values as "-".  It's not quite the same, but it may give you the visual distinction for null values that you are looking for.
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 07 Jan 2008 at 5:34am
I think that you are really headed down the wrong path with your stored procedure solution.  This will end in tears and frustration.  Even if it does eventually work.

Two important questions:
Is your list of stations static enough that you would be willing to change the query if there is a change in the stations?
Do you always want to see all the data for all the stations?

If the answer to both questions is "yes," then there is a way to do a kind of false cross-tab in SQL.  However, all of the column headings are hard-coded.  So, you have to manually go in and change it if the list of stations changes.

The key to this solution is the CASE function.  Your SQL would start something like:


SELECT date1, time1,
(CASE Station_id WHEN "Station1" THEN today_rain ELSE 0 END) AS Station1_Today,
(CASE Station_id WHEN "Station2" THEN today_rain ELSE 0 END) AS Station2_Today,
(CASE Station_id WHEN "Station3" THEN today_rain ELSE 0 END) AS Station3_Today


You can either sum your columns in the SQL statement (generally the preferred method, as otherwise you see a LOT of zeroes), or in Crystal, grouping by your date and time values.




IP IP Logged
trupu k
Newbie
Newbie
Avatar

Joined: 26 Oct 2007
Location: India
Online Status: Offline
Posts: 10
Quote trupu k Replybullet Posted: 17 Jan 2008 at 3:32am

thank u

i mean i want to insert line after first column.
 
like
 
                         station1                               station2
date          curr_rain      total_rain        curr_rain      total_rain
 
 
suppose above cross tab.
i want line after column 'Curr_rain' in each section of station 1 and 2
tru
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.027 seconds.