Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tash4206
Starting Member
7 Posts |
Posted - 2008-03-31 : 16:41:56
|
IDE: SSRS 2005report properties>>codeI need custom code help to do the following:I'd like to be able to perform COUNT number of rows returned from the DataSet. For Example:=======Code Tab=====Public Function CountRows("grp_Name") as String Table_A = Count number of rows returned in a dataset. i.e. CountRows("grp_Name")Return Table_AEnd Function=======Call from ====Report Parameters>>Default values:(non-queried)=Code.CountRows("grp_Name") -- run the code as expression passing parameter.-----------------------------------------I need this functionality to be callable from a Parameters!XXX.value expression reference. Thanks! |
|
jhermiz
3564 Posts |
Posted - 2008-04-01 : 09:53:09
|
quote: Originally posted by tash4206 IDE: SSRS 2005report properties>>codeI need custom code help to do the following:I'd like to be able to perform COUNT number of rows returned from the DataSet. For Example:=======Code Tab=====Public Function CountRows("grp_Name") as String Table_A = Count number of rows returned in a dataset. i.e. CountRows("grp_Name")Return Table_AEnd Function=======Call from ====Report Parameters>>Default values:(non-queried)=Code.CountRows("grp_Name") -- run the code as expression passing parameter.-----------------------------------------I need this functionality to be callable from a Parameters!XXX.value expression reference. Thanks!
You're making this too hard than what it really is. Just get the COUNT(*) directly in your SPROC for your dataset.Or use the RowNumber function in Reporting Services:=RowNumber(Nothing) In a text box, or use =RowNumber(YourGroupNameHere) to do it on a group.JonWeblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-01 : 10:28:59
|
quote: Originally posted by tash4206 IDE: SSRS 2005report properties>>codeI need custom code help to do the following:I'd like to be able to perform COUNT number of rows returned from the DataSet. For Example:=======Code Tab=====Public Function CountRows("grp_Name") as String Table_A = Count number of rows returned in a dataset. i.e. CountRows("grp_Name")Return Table_AEnd Function=======Call from ====Report Parameters>>Default values:(non-queried)=Code.CountRows("grp_Name") -- run the code as expression passing parameter.-----------------------------------------I need this functionality to be callable from a Parameters!XXX.value expression reference. Thanks!
DIdnt understand need of a new function. Cant you use the standard countrows function in reporting services?[url]http://msdn2.microsoft.com/en-us/library/ms156330.aspx[/url] |
|
|
tash4206
Starting Member
7 Posts |
Posted - 2008-04-01 : 11:13:12
|
I need to pass the number from countRows() as a parameter, so that the information is logged on [parameters].[dbo.ExecutionLog] table in ReportServer. My question is there a way to create a parameter from a reportItems!xxx.value reference or Aggregate function??Thanks! |
|
|
jhermiz
3564 Posts |
Posted - 2008-04-01 : 11:19:23
|
quote: Originally posted by tash4206 I need to pass the number from countRows() as a parameter, so that the information is logged on [parameters].[dbo.ExecutionLog] table in ReportServer. My question is there a way to create a parameter from a reportItems!xxx.value reference or Aggregate function??Thanks!
This is a very simple solution.The countrows is simply a count of the rows based on your group.Use it as a dataset! That way you can then use it in the parameters sectionTake a look at this, I wrote it 2 weeks ago it is perfect for you..ignore that it deals with dates, but understand that it is simply a dataset and can be added as a parameter.http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=99696JonWeblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url] |
|
|
|
|
|