Home » WPFRSS

how to write custom code basing on two rows

Hi,

I have done some custom code.Now i m stuck at one point where i m not getting out..

Problem is like.I have two columns. i need to create a count if those two columns are having same values.

I need to write a function to get the count please suggest how to write that function the count of same values for both columns..I need to return that count to a text box so that i can show on report.

Sample data is like

col1               col2

231                231

4443             4443

8857             8857

0                   0

332               876

 

 

Count is four .I need to retrun this count to a text box ..please suggest a function so that i can return to the report...

 

 

 

8 Answers Found

 

Answer 1

Here You Go :

Public count  AS INTEGER = 0
 FUNCTION CountFUNCTION(ByVal Field AS INTEGER , ByVal Field1 AS INTEGER)  AS INTEGER
IF (Field <> 0 AND Field1 <> 0) Then
IF (Field = Field1) Then
count= count+1
End IF
End IF
return  count
End FUNCTION

FUNCTION  ReturnCount()  AS INTEGER
return  count
End Function


Rajkumar Yelugu
 

Answer 2

Hi have doubt.How it takes col1 as field and col2 as field1...I have no of columns  in that report...
 

Answer 3

Add another Column to your Table and hide that column .

Detail Row Expression =Code.CountFUNCTION(Fields!col1.Value , Fields!Col2.Value)

Footer Row count  Textbox Expression =Code.ReturnCount()

 

Answer 4

create

 

table #t (c1 int,c2 int)

insert

 

into #t values(231,231)

insert

 

into #t values(4443,4443)

insert

 

into #t values(8857,8857)

insert

 

into #t values(55,11)

insert

 

into #t values(0,0)

select

 

count(#t.c1)from #t

join

 

#t t on t.c1=#t.c2

 

Answer 5

vishvesk,

The way i pointed you only works  for RS 2005 Version but not in RS 2008 .

Thanks

 


Rajkumar Yelugu
 

Answer 6

Ok.reasons for that....
 

Answer 7

RS2008 architecture is different from RS2005 .

Hidden columns  doesnt  get evaluated In RS 2008 , Will have to think about an alternative .

http://blogs.msdn.com/b/robertbruckner/archive/2008/07/20/using-group-variables-in-reporting-services-2008-for-custom-aggregation.aspx

Click the link for further reference

Thanks .

 

 

Answer 8

k.thanks man..
 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter