C
Cip
I have several crossTab type reports in a VB app.
I am displaying these reports in a Datagrid. The Datagrid gets its
data directly from a stored proc I have created on SQL Server 2000
(rp_crossTab) which returns data in a nice crossTab fashion. (The
stored proc accepts parameters such as onRows, onCol, sumBy, etc.)
My problem is I have several crossTab reports which actually depend on
data found in other crossTabs.
For example, I have this total paid amount crossTab:
REPORTA
Name/Month Jan Feb Mar
Jon 20 40 40
Jack 100 50 200
Jill 25 75 75
And another report might be a month-to-month ratio of the total paid
amount:
(this report clearly depends on REPORTA)
REPORTB
Name Jan to Feb Feb to Mar
Jon 2 1
Jack 0.5 4
Jill 3 1
I thought of two ways to create REPORTB:
1) Call another stored proc which then calls rp_CrossTab, and performs
the necessary calculations using tempTables.
2) Creating a new table using new DataColumn objects in .NET and
setting their necessary values in the "Expression" field (eg
"Jan/Feb") and also making the columns dependent on REPORTA.
I can think of various problems with both scenarios...
Correct me if I am wrong but solution 1 would take a huge performance
hit since it would be in fact re-calculating REPORT A in order to
generate REPORT B.
Solution 2 sucks because I would have to hard-code logic in my .NET
app and I dont really wanna do that.... as well I dont think I can use
custom functions in the column Expression field (eg.
DataColumn.Expression = "MyWeightedAverage(COL1,COL2,COL3)")
What is the best way to create this second (or any other dependent)
report?
Is there something I have missed?
Is it generally better to have ALL logic in stored procs... even it is
much slower?
Thanks a lot, I really appreciate any comments anyone may have.
I am displaying these reports in a Datagrid. The Datagrid gets its
data directly from a stored proc I have created on SQL Server 2000
(rp_crossTab) which returns data in a nice crossTab fashion. (The
stored proc accepts parameters such as onRows, onCol, sumBy, etc.)
My problem is I have several crossTab reports which actually depend on
data found in other crossTabs.
For example, I have this total paid amount crossTab:
REPORTA
Name/Month Jan Feb Mar
Jon 20 40 40
Jack 100 50 200
Jill 25 75 75
And another report might be a month-to-month ratio of the total paid
amount:
(this report clearly depends on REPORTA)
REPORTB
Name Jan to Feb Feb to Mar
Jon 2 1
Jack 0.5 4
Jill 3 1
I thought of two ways to create REPORTB:
1) Call another stored proc which then calls rp_CrossTab, and performs
the necessary calculations using tempTables.
2) Creating a new table using new DataColumn objects in .NET and
setting their necessary values in the "Expression" field (eg
"Jan/Feb") and also making the columns dependent on REPORTA.
I can think of various problems with both scenarios...
Correct me if I am wrong but solution 1 would take a huge performance
hit since it would be in fact re-calculating REPORT A in order to
generate REPORT B.
Solution 2 sucks because I would have to hard-code logic in my .NET
app and I dont really wanna do that.... as well I dont think I can use
custom functions in the column Expression field (eg.
DataColumn.Expression = "MyWeightedAverage(COL1,COL2,COL3)")
What is the best way to create this second (or any other dependent)
report?
Is there something I have missed?
Is it generally better to have ALL logic in stored procs... even it is
much slower?
Thanks a lot, I really appreciate any comments anyone may have.