jaz237
Technical User
- Jan 6, 2006
- 12
Using Crystal Reports XI rel 2 with SQL Database through ODBC
This report is a PACE report comparing where we are this year based on exactly where we were at this point last year. So the table structure is such that one set of tables pulls current information and a table named Snapshot tracks changes to significant data such as room nights.
I am attempting to migrate this report into Crystal in order to eliminate having to enter data in an Excel spreadsheet. Currently the spreadsheet houses the data from the previous year as it was entered and uses formulas to calculate the difference.
Here is the Crosstab representing the PACE report:
2008 RM Produced Total Rooms Prior Yr Variance
this month Total Rooms # and %
01/2008 0 41,420 54,498
02/2008 0 84,966 30,481
03/2008 0 65,356 25,896
04/2008 0 32,036 10,001
05/2008 2714 25,842 5,770
06/2008 245 29,741 9,560
07/2008 20 17,863 11,938
08/2008 0 11,037 13,558
09/2008 45 7,518 722
10/2008 0 27,227 9,415
11/2008 713 20,223 10,424
12/2008 0 20,400 12,655
The first column represents the room nights produced this month in the corresponding arrival dates (row is command.arrival1.)
Here is the formula (@current):
To deal with multiple returns from the snapshot table I have this formula in the crosstab (@maximumcurrent):
The second column uses the following formula (@total):
with the following formula in the crosstab (@maximumtotal)
The formula for the third column (@PreviousYR)
does not give me the data I need and it moves the crosstab back to 2007.
I need a way to compare the total room nights for this year to the total room for the last year (with each lead represented only once) in the same crosstab. I worked with the grouping (arrival1 by year and arrival1 by month). But I was unable to write the appropiate formula to group the crosstab.
Here is the command written to pull the data from the database:
When I am able to pull the data for both years accurately then I need to give the variance in the years as a number and a percentage.
Thank you so much in advance for any response. I have been working on this report for almost a month and look forward to it being correct! I attempted to be a thorough as possible but please feel free to ask questions if any information is unclear.
Julie
This report is a PACE report comparing where we are this year based on exactly where we were at this point last year. So the table structure is such that one set of tables pulls current information and a table named Snapshot tracks changes to significant data such as room nights.
I am attempting to migrate this report into Crystal in order to eliminate having to enter data in an Excel spreadsheet. Currently the spreadsheet houses the data from the previous year as it was entered and uses formulas to calculate the difference.
Here is the Crosstab representing the PACE report:
2008 RM Produced Total Rooms Prior Yr Variance
this month Total Rooms # and %
01/2008 0 41,420 54,498
02/2008 0 84,966 30,481
03/2008 0 65,356 25,896
04/2008 0 32,036 10,001
05/2008 2714 25,842 5,770
06/2008 245 29,741 9,560
07/2008 20 17,863 11,938
08/2008 0 11,037 13,558
09/2008 45 7,518 722
10/2008 0 27,227 9,415
11/2008 713 20,223 10,424
12/2008 0 20,400 12,655
The first column represents the room nights produced this month in the corresponding arrival dates (row is command.arrival1.)
Here is the formula (@current):
Code:
if ({Command.updatedate} = (lastfullmonth)) and ({Command.Arrival1}>= date ('01-01-2008')) and ({Command.statusid}=(105)) then {Command.BlockRooms}
Code:
if {Command.snapid} = Maximum ({Command.snapid}, {Command.oppid}) then {@RoomNightsBkCurrentMth}
The second column uses the following formula (@total):
Code:
if ({Command.statusid} in ([105,115])) and ({Command.Arrival1} >= date('01-01-2008')) and ({Command.Arrival1} <= date('12-31-2014')) then {Command.BlockRooms}
Code:
if {Command.snapid} = Maximum ({Command.snapid}, {Command.oppid}) then {@TotalRoomNights}
The formula for the third column (@PreviousYR)
Code:
if {Command.snapdate} <= date('04-30-2007') and {Command.Arrival1} >= date('01-01-2007') and {Command.statusid} in [105,115] then {Command.rooms}
I need a way to compare the total room nights for this year to the total room for the last year (with each lead represented only once) in the same crosstab. I worked with the grouping (arrival1 by year and arrival1 by month). But I was unable to write the appropiate formula to group the crosstab.
Here is the command written to pull the data from the database:
Code:
SELECT o.oppid, a.Company, o.LeadName, o.Arrival1, o.Departure1, o.RoomAttend, o.showattend, o.PeakRoom, o.BlockRooms, o.DecisionDate, o.statusid as currentstatus, vw.snapdate, vw.rooms, vw.arrival, vw.statusid as snapstatus, vw.snapid, ot.updatedate, ot.statusid
FROM Opps_Meeting o INNER JOIN
vwSnapshot_Meeting vw ON o.oppid = vw.oppid INNER JOIN
Accounts_Meeting a ON o.AcctID = a.AcctID INNER JOIN
OppStatus os ON o.StatusID = os.StatusID INNER JOIN
OppTrace ot ON o.oppid = ot.oppid inner join
OppStatus ost ON ot.statusid = ost.statusid LEFT OUTER JOIN (UDFLists udf_66 INNER JOIN UDFListValues ul_66 ON udf_66.listID = ul_66.listID) ON (udf_66.fieldID = 66 AND ul_66.recID = o.oppid) LEFT OUTER JOIN (UDFLists udf_68 INNER JOIN UDFListValues ul_68 ON udf_68.listID = ul_68.listID) ON (udf_68.fieldID = 68 AND ul_68.recID = o.Oppid) inner join udflists ul_67 INNER JOIN
UDFListValues udf_67 ON ul_67.listid = udf_67.listid ON o.oppid = udf_67.recid AND ul_67.fieldid = 67
WHERE o.del=0 AND udf_67.listid=154
When I am able to pull the data for both years accurately then I need to give the variance in the years as a number and a percentage.
Thank you so much in advance for any response. I have been working on this report for almost a month and look forward to it being correct! I attempted to be a thorough as possible but please feel free to ask questions if any information is unclear.
Julie