Showing posts with label utility. Show all posts
Showing posts with label utility. Show all posts

Wednesday, March 7, 2012

error with rs.exe utility

I'm getting some errors when I run rs.exe from command line with regard to Parameters, and was hoping I might get some help here. I'm somewhat new to RS. I'm running SQL 2000 and RS 2000 on a Windows 2003 Server.

Here is my script:
***********************************************************
' File: RunReport.rss
Dim format as string = "Excel"
Dim fileName as String = "C:\Export2.xls"
Dim reportPath as String = "/APSAgentCourseCompletionByUserGroup"

Public Sub Main()

' Prepare Render arguments
Dim historyID as string = Nothing
Dim deviceInfo as string = Nothing
Dim showHide as string = Nothing
Dim results() as Byte
Dim encoding as string
Dim mimeType as string = "ms-excel"
Dim warnings() AS Warning = Nothing
Dim reportHistoryParameters() As ParameterValue = Nothing
Dim streamIDs() as string = Nothing
rs.Credentials = System.Net.CredentialCache.DefaultCredentials

' Report Parameters
Dim parameters(5) As ParameterValue
parameters(0) = New ParameterValue()
parameters(0).Name = "User Group"
parameters(0).Value = "66179312-f341-4df7-a855-79c5b8abaf9f"
parameters(1) = New ParameterValue()
parameters(1).Name = "Start Date"
parameters(1).Value = "12/22/2006"
parameters(2) = New ParameterValue()
parameters(2).Name = "End Date"
parameters(2).Value = "2/17/2007"
parameters(3) = New ParameterValue()
parameters(3).Name = "Course Name"
parameters(3).Value = "AA2B1AA0-E78A-4F84-834F-8EAAB75BEBD3"
parameters(4) = New ParameterValue()
parameters(4).Name = "Status To Include"
parameters(4).Value = "0"
results = rs.Render(reportPath, format, _
Nothing, Nothing, parameters, _
Nothing, Nothing, encoding, mimeType, _
reportHistoryParameters, warnings, streamIDs)

' Open a file stream and write out the report
Dim stream As FileStream = File.OpenWrite(fileName)
stream.Write(results, 0, results.Length)
stream.Close()

End Sub

'End of script
***********************************************************

As you can see, right now I've got all 5 report parameters hard-coded.

Here is the command line that I'm using as well as the error that I receive:

rs.exe -i c:\RunReport.rss -s http://localhost/reportserver -t
Unhandled exception: The value of parameter 'Parameters' is not valid. Check the documentation for information about valid values.

Any insight that anyone can provide is greatly appreciated.

Thanks!

Raywhat...? no response to this yet? i'm desperately seeking samples for
how to use this rs.exe utility, and there's just not enough out there.

a comprehensive tutorial would be nice too actually; but thats just a dream at this point.
|||Yeah, i was really hoping that someone would respond to it as well, but luckily i stumbled upon my own solution. The error that I was receiving was because the array I initialized was incremented by too much. Instead of

Dim parameters(5) As ParameterValue

it should have been:

Dim parameters(4) As ParameterValue

Once I made that change the script was executing just fine!

Hope this helps you somewhat. Are you receiving other errors?

error with rs.exe utility

I'm getting some errors when I run rs.exe from command line with regard to Parameters, and was hoping I might get some help here. I'm somewhat new to RS. I'm running SQL 2000 and RS 2000 on a Windows 2003 Server.

Here is my script:
***********************************************************
' File: RunReport.rss
Dim format as string = "Excel"
Dim fileName as String = "C:\Export2.xls"
Dim reportPath as String = "/APSAgentCourseCompletionByUserGroup"

Public Sub Main()

' Prepare Render arguments
Dim historyID as string = Nothing
Dim deviceInfo as string = Nothing
Dim showHide as string = Nothing
Dim results() as Byte
Dim encoding as string
Dim mimeType as string = "ms-excel"
Dim warnings() AS Warning = Nothing
Dim reportHistoryParameters() As ParameterValue = Nothing
Dim streamIDs() as string = Nothing
rs.Credentials = System.Net.CredentialCache.DefaultCredentials

' Report Parameters
Dim parameters(5) As ParameterValue
parameters(0) = New ParameterValue()
parameters(0).Name = "User Group"
parameters(0).Value = "66179312-f341-4df7-a855-79c5b8abaf9f"
parameters(1) = New ParameterValue()
parameters(1).Name = "Start Date"
parameters(1).Value = "12/22/2006"
parameters(2) = New ParameterValue()
parameters(2).Name = "End Date"
parameters(2).Value = "2/17/2007"
parameters(3) = New ParameterValue()
parameters(3).Name = "Course Name"
parameters(3).Value = "AA2B1AA0-E78A-4F84-834F-8EAAB75BEBD3"
parameters(4) = New ParameterValue()
parameters(4).Name = "Status To Include"
parameters(4).Value = "0"
results = rs.Render(reportPath, format, _
Nothing, Nothing, parameters, _
Nothing, Nothing, encoding, mimeType, _
reportHistoryParameters, warnings, streamIDs)

' Open a file stream and write out the report
Dim stream As FileStream = File.OpenWrite(fileName)
stream.Write(results, 0, results.Length)
stream.Close()

End Sub

'End of script
***********************************************************

As you can see, right now I've got all 5 report parameters hard-coded.

Here is the command line that I'm using as well as the error that I receive:

rs.exe -i c:\RunReport.rss -s http://localhost/reportserver -t
Unhandled exception: The value of parameter 'Parameters' is not valid. Check the documentation for information about valid values.

Any insight that anyone can provide is greatly appreciated.

Thanks!

Ray

what...? no response to this yet? i'm desperately seeking samples for
how to use this rs.exe utility, and there's just not enough out there.

a comprehensive tutorial would be nice too actually; but thats just a dream at this point.
|||Yeah, i was really hoping that someone would respond to it as well, but luckily i stumbled upon my own solution. The error that I was receiving was because the array I initialized was incremented by too much. Instead of

Dim parameters(5) As ParameterValue

it should have been:

Dim parameters(4) As ParameterValue

Once I made that change the script was executing just fine!

Hope this helps you somewhat. Are you receiving other errors?

Friday, February 17, 2012

Error while loading custom assembly in Designer

I've created a custom assembly using C# that provides utility functions for
reporting services. I'm getting a the following compile time errors.
1. Error while loading code module: 'accentopto.report.utilities,
Version=1.0.1885.19928, Culture=en-US, PublicKeyToken=null'. Details: File or
assembly name accentopto.reporting.utilities, or one of its dependancies, was
not found.
2. Error in class instance declaration for class Utilities: [BC30002] Type
'Utilities' is not defined.
I've verified the version metadata using ildasm.
Here are the CodeModules and Classes elements from the .rdl file.
<CodeModules>
<CodeModule>accentopto.report.utilities, Version=1.0.1885.19928,
Culture=en-US, PublicKeyToken=null</CodeModule>
</CodeModules>
<Classes>
<Class>
<ClassName>Utilities</ClassName>
<InstanceName>Utilities</InstanceName>
</Class>
</Classes>
Here is the CodeGroup element in the rspreviewpolicy.config file for the
Designer
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="Execution"
Name="Accent_Reporting_Utilities"
Description="Code group for Accent data processing extensions">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\80\Tools\Report
Designer\accentopto.report.utilities.dll"/>
</CodeGroup>
I've verified that the assembly is in the Report Designer directory.
Here's the code snippet from the Utilities class.
--
using System;
using System.Globalization;
namespace com.accentopto.bizlogic.reporting.rs_shared
{
/// <summary>
/// Shared reporting utilities
/// </summary>
public class Utilities
{
private CultureInfo culture;
private Calendar calendar;
public Utilities()
{
this.culture = new CultureInfo("en-US", false);
this.calendar = culture.Calendar;
}
protected DateTime WeekEndDate(string inDate)
{
DateTime dateOut, dateIn;
string day;
dateIn = Convert.ToDateTime(inDate, culture);
day = dateIn.DayOfWeek.ToString();
switch(day)
{
case "Sunday":
dateOut = dateIn.AddDays(6);
break;
case"Monday":
dateOut = dateIn.AddDays(5);
break;
case "Tuesday":
dateOut = dateIn.AddDays(4);
break;
case "Wednesday":
dateOut = dateIn.AddDays(3);
break;
case "Thursday":
dateOut = dateIn.AddDays(2);
break;
case "Friday":
dateOut = dateIn.AddDays(1);
break;
default:
dateOut = dateIn;
break;
}
return dateOut;
}
/*
* Entry point for testing only
*
public static void Main(string []args)
{
string printDate;
Utilities util;
util = new Utilities();
printDate = util.WeekEndDate(args[0]).ToString();
Console.WriteLine(printDate);
}
*/
}
}
The only thing that I can think of is that my refs to System.Globalization
aren't available.
Thanks for any help.
--
Chris Mackey
Sr. Software Developer
Accent Optical TechnologiesSorry about the redundant entry. The server gave me an error on the first
submission so I thought that it didn't go through. In fact the error message
said that it didn't. Please remove this entry.
"Chris Mackey" wrote:
> I've created a custom assembly using C# that provides utility functions for
> reporting services. I'm getting a the following compile time errors.
> 1. Error while loading code module: 'accentopto.report.utilities,
> Version=1.0.1885.19928, Culture=en-US, PublicKeyToken=null'. Details: File or
> assembly name accentopto.reporting.utilities, or one of its dependancies, was
> not found.
> 2. Error in class instance declaration for class Utilities: [BC30002] Type
> 'Utilities' is not defined.
> I've verified the version metadata using ildasm.
> Here are the CodeModules and Classes elements from the .rdl file.
> <CodeModules>
> <CodeModule>accentopto.report.utilities, Version=1.0.1885.19928,
> Culture=en-US, PublicKeyToken=null</CodeModule>
> </CodeModules>
> <Classes>
> <Class>
> <ClassName>Utilities</ClassName>
> <InstanceName>Utilities</InstanceName>
> </Class>
> </Classes>
> Here is the CodeGroup element in the rspreviewpolicy.config file for the
> Designer
> <CodeGroup class="UnionCodeGroup"
> version="1"
> PermissionSetName="Execution"
> Name="Accent_Reporting_Utilities"
> Description="Code group for Accent data processing extensions">
> <IMembershipCondition class="UrlMembershipCondition"
> version="1"
> Url="C:\Program Files\Microsoft SQL Server\80\Tools\Report
> Designer\accentopto.report.utilities.dll"/>
> </CodeGroup>
> I've verified that the assembly is in the Report Designer directory.
> Here's the code snippet from the Utilities class.
> --
> using System;
> using System.Globalization;
> namespace com.accentopto.bizlogic.reporting.rs_shared
> {
> /// <summary>
> /// Shared reporting utilities
> /// </summary>
> public class Utilities
> {
> private CultureInfo culture;
> private Calendar calendar;
> public Utilities()
> {
> this.culture = new CultureInfo("en-US", false);
> this.calendar = culture.Calendar;
> }
> protected DateTime WeekEndDate(string inDate)
> {
> DateTime dateOut, dateIn;
> string day;
> dateIn = Convert.ToDateTime(inDate, culture);
> day = dateIn.DayOfWeek.ToString();
> switch(day)
> {
> case "Sunday":
> dateOut = dateIn.AddDays(6);
> break;
> case"Monday":
> dateOut = dateIn.AddDays(5);
> break;
> case "Tuesday":
> dateOut = dateIn.AddDays(4);
> break;
> case "Wednesday":
> dateOut = dateIn.AddDays(3);
> break;
> case "Thursday":
> dateOut = dateIn.AddDays(2);
> break;
> case "Friday":
> dateOut = dateIn.AddDays(1);
> break;
> default:
> dateOut = dateIn;
> break;
> }
> return dateOut;
> }
> /*
> * Entry point for testing only
> *
> public static void Main(string []args)
> {
> string printDate;
> Utilities util;
> util = new Utilities();
> printDate = util.WeekEndDate(args[0]).ToString();
> Console.WriteLine(printDate);
> }
> */
> }
> }
> The only thing that I can think of is that my refs to System.Globalization
> aren't available.
> Thanks for any help.
> --
> Chris Mackey
> Sr. Software Developer
> Accent Optical Technologies