Question

I have a report that shows me all columnames on a server. For each db the columname is used in it shows me what datatype is it is. E.g.:

ColumnName | Type        | DB_Name

Teacher_id | varchar(25) | DB1
           | int         | DB2
Classroom  | varchar(25) | DB1
           | varchar(100)| DB2
Course_id  |  int        | DB2

You see that datatypes are grouped by ColumnName . Now I have put in a filter on the ColumName grouping that only shows me the ColumnNames with more then one datatype.

Teacher_id | varchar(25) | DB1
           | int         | DB2
Classroom  | varchar(25) | DB1
           | varchar(100)| DB2

But now when I do a countdistinct on ColumnName it shows me the total number of all columnames, also the ones that are hidden....... So it does not produce 2 but 3 I suspect that this is caused by the fact that filtering is done on the report and not on the dataset but I feel I should still be able to count the number of occurences of columname in the report..... I tried =count(reportitems!Columname.value) in the pageheader but that gives me the number of columnnames on that page, not in the report!

What is happening here? How do I count the number of ColumNames in the report? Is there f.e. a reportheader instead of a pageheader that I could use?

Was it helpful?

Solution

  • COUNT(Fields!FieldName.Value) : Gives you the count of value in the current scope.

  • COUNT(Fields!FieldName.Value,"yourDataSetName") : Gives you the count of value in the dataset.

  • COUNT(Fields!FieldName.Value,"yourGroupName") : Gives you the count of value in the current Group.

You might have to return the desired value with your query if you are using filtering. Filtered values are not included in aggregates within groups. However, please test this at the dataset level by doing the following:

Place a text box above the table or matrix and give it a value of COUNT(Fields!FieldName.Value,"yourDataSetName"). If it does not equate then you will need to return this with your data.

Solution two

Open up Report Properties Code and add this custom code:

Public Shared Dim _RenderedCount As Integer=0

Public Shared Function ReInitRenderedCount() As string
    _RenderedCount=0
    return ""
End Function

Public Shared Function UpdateRenderedCount() As string
        _RenderedCount = _RenderedCount +1
    return ""
End Function

Public Shared Function GetRenderedCount() As Int    
    Dim ret As Int  
    ret=_RenderedCount
    Return ret
End Function

I have added snippets like this before where basically you set a visible column with no background somewhere on your detail line, perhaps the last column. Then you can set its value=Code.UpdateRenderedCount() which updates the rendered count but returns "". You can then inspect and print the rendered count using label.value=Code.GetRenderedCount().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top