Crosstab dynamic data display

This public forum is for user-to-user discussions of ASP Report Maker. Note that this is not support forum.

Crosstab dynamic data display

Postby ready4data » Mon Mar 21, 2016 7:29 pm

I need to be able to color code fields in a crosstab report depending on what the user selects in the source table. (The options are 1 through 5)
I was able to do it by appending the crosstab's Value source field in the query with the option number.
This returns values like 2CompanyA, 1CompanyA, 4CompanyB, 3CompanyB
I then color code the fields using this code in the Row_Rendered event of the crosstab report.
For i = 0 to UBound(rptSchedule.SummaryCurrentValue)
If Left(rptSchedule.SummaryCurrentValue(i),1) = "1" Then
Call ewr_SetAttr(rptSchedule.SummaryCellAttrs(i), "style", "background-color: #ff0000;")'Red
End If
If Left(rptSchedule.SummaryCurrentValue(i),1) = "2" Then
Call ewr_SetAttr(rptSchedule.SummaryCellAttrs(i), "style", "background-color: #ffff00;")'Yellow
End If
If Left(rptSchedule.SummaryCurrentValue(i),1) = "3" Then
Call ewr_SetAttr(rptSchedule.SummaryCellAttrs(i), "style", "background-color: #006600;")'Green
End If
If Left(rptSchedule.SummaryCurrentValue(i),1) = "4" Then
Call ewr_SetAttr(rptSchedule.SummaryCellAttrs(i), "style", "background-color: #0066cc;")'Blue
End If
If Left(rptSchedule.SummaryCurrentValue(i),1) = "5" Then
Call ewr_SetAttr(rptSchedule.SummaryCellAttrs(i), "style", "background-color: #6600cc;")'Purple
End If
Next
My question is how can I strip the first character of the value field In the crosstab report so it only shows CompanyA, CompanyB, etc.
I assume I would have to use the Mid function but I'm not sure what to use for the string in that function.
I tried using rptSchedule.SummaryCurrentValue(I) but it didn't work.

Scott
ready4data
 
Posts: 276
Joined: Mon Nov 19, 2012 8:24 pm

Re: Crosstab dynamic data display

Postby motfs » Thu Mar 24, 2016 6:35 pm

Try this:
Set smry = <crosstabreport>.SummaryFields(0)
For i = 0 to UBound(smry.SummaryCurrentValue) - 1
smry.SummaryViewValue(i) = "xxx" ' Your code to replace
Next
motfs
 
Posts: 710
Joined: Tue Sep 08, 2015 4:55 pm

Re: Crosstab dynamic data display

Postby ready4data » Fri Mar 25, 2016 8:55 pm

Perfect, Thanks
Set smry = <crosstabreport>.SummaryFields(0)
For i = 0 to UBound(smry.SummaryCurrentValue) - 1
smry.SummaryViewValue(i) = Mid(smry.SummaryViewValue(i),2,10)
Next

Scott
ready4data
 
Posts: 276
Joined: Mon Nov 19, 2012 8:24 pm


Return to General Discussion (ASP Report Maker)