Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab Each Row MinValue - dynamic rows to check

Status
Not open for further replies.

smsaji

Programmer
Jun 26, 2005
91
CA
Using Crystal Report 10. SQL Server Stored procedure as datasource.

In the crosstab report, right now, able to highlight min value in each row (made possible, from this forum) . Have 3 columns. From stored procedure, bringing the each row min value to the report, (using 3 temp tables )and as 3 extra columns, min1, min2, min3.

The stored proc brings foll result data:

Row Col SummaryFld Min1 Min2 Min3

Row1 Col1 2 2 1 5
Row1 Col2 4 2 1 5
Row1 Col3 6 2 1 5

Row2 Col1 1 2 1 5
Row2 Col2 2 2 1 5
Row2 Col3 3 2 1 5

Row3 Col1 5 2 1 5
Row3 Col2 4 2 1 5
Row3 Col3 6 2 1 5

Checking like foll. in Crystal report:

if GridRowColumnValue("ProcName.ROW_NAME") = "row1" then
(
if CurrentFieldValue = { ProcName.Min1} then crYellow else
crwhite
) else

if GridRowColumnValue("ProcName .ROW_NAME") = "row2" then
(
if CurrentFieldValue = { ProcName.MinTtime2} then crYellow else
crwhite
)else

if GridRowColumnValue("ProcName.ROW_NAME") = "row3" then
(
if CurrentFieldValue = { ProcName.MinTtime3} then crYellow else
crwhite
) else
crwhite


Now there are crosstab reports with 40 rows and 30 rows. The row may increase as and when new data are inserted into table.

Is there any way to compare the min values without having to create extra 40 columns as min1 to min40. (Also need to use 40 temp tables to get the each row min value)

Also if new data is inserted into table, this will not be reflected , since the rowcode will be hardcoded in stored proc. as :

Select RowCode, RowName, min(summaryfld) into #temp1
From table1
Where RowCode=’RowCode1’

Select RowCode, RowName, min(summaryfld) into #temp2
From table1
Where RowCode=’RowCode2’

Any solutions?



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top