Accessing Parameters In Custom Code
Feb 21, 2008
Hi,
I am trying to retrieve and manipulate the value of the stored procedure parameters in the following custom code:
Code Snippet
Public Function ShowLoading(ByVal intOption as integer, byVal BasicLoading as string, byVal BasicHealthExtra as string, byVal RiderLoading as string, byVal RiderHealthExtra as string, byVal TotalAmount as string) As string
dim strRider as String
dim strCompanyName as string
strCompanyName = Fields!CompanyName.Value
select case strCompanyName
case "and Plus Rider ":
strRider = "Plus Rider"
case "and Assist Rider ":
strRider = "Assist Rider"
end select
return strRider
End Function
However, i got this error when I try to preview the report: An error occurred during local report processing, The definition of the report :
'/reportC' is invalid. There is an error on line 5 of custom code: [BC30469] Reference to a non-shared member requires an object reference.
Any help is greatly appreciated. Thanks in advance.
View 1 Replies
ADVERTISEMENT
Jun 12, 2007
Hi,
My report has multiple datasets, and I want to access the fields of a particular dataset from custom code. The problem is that the name of the dataset to use is only calculated during the execution of the custom code.
Allow me to illustrate:
public function Test(data as DataSets, fieldName as string)dim datasetName as string = CalculateDatasetName()dim ds as Dataset = data(datasetName)' now here I want to get the fieldName out of the dataset.' in the report, I would do something like
' First(Fields!fieldName.Value, datasetName)' but in custom code, this obviously doesn't work.end function
I've been looking for a way to accomplish this, but it seems you cannot get data from a dataset through custom code (there is only the commandtext property). Also it is not possible to pass the Fields collection as a parameter, as I do not know the dataset name when in the report designer.
I hope my problem description is clear.
Does anyone know how to solve this issue?
Thanks,
Phil
View 2 Replies
View Related
Oct 16, 2007
Hi all,
Could someone tell me if custom code function can capture the event caused by a user? For example, onclick event on the rendered report?
Also, can custom code function alter the parameters of the report, or refresh the report?
Thanks.
View 2 Replies
View Related
May 11, 2007
I am attempting to set my custom properties in the UI I have created for my custom transformation. I can access them in the ProcessInput, but if I try to assign them a new value in my UI the values dont change.
I set the properties up in ProvideComponentProperties
public override void ProvideComponentProperties()
{
// Perform component setup operations
ComponentMetaData.UsesDispositions = false;
// Add Input
IDTSInput90 input = ComponentMetaData.InputCollection.New();
input.Name = "TrimInput";
input.ErrorRowDisposition = DTSRowDisposition.RD_NotUsed;
// Add Output
IDTSOutput90 output = ComponentMetaData.OutputCollection.New();
output.Name = "TrimOutput";
output.SynchronousInputID = input.ID;
IDTSCustomProperty90 Trimproperty = ComponentMetaData.CustomPropertyCollection.New();
Trimproperty.Name = "Trim Values";
Trimproperty.Description = "Selected Trim Values";
IDTSCustomProperty90 Colproperty = ComponentMetaData.CustomPropertyCollection.New();
Colproperty.Name = "Col Names";
Colproperty.Description = "Column Names";
}
btn Click event in UI form
IDTSCustomProperty90 Trimproperty = _dtsComponentMetaData.CustomPropertyCollection["Trim Values"];
Trimproperty.Value = sConcatTrim;
IDTSCustomProperty90 Colproperty = _dtsComponentMetaData.CustomPropertyCollection["Col Names"];
Colproperty.Value = sConcatColNames;
Any suggestions or please point me to any example would be greatly appreciated.
View 3 Replies
View Related
Feb 21, 2007
Hi,
Given that Task.Validate() exposes the package's VariableDispenser, but LogProviderBase.Validate() doesn't...
http://msdn2.microsoft.com/fr-fr/library/microsoft.sqlserver.dts.runtime.task.validate.aspx
http://msdn2.microsoft.com/fr-fr/library/microsoft.sqlserver.dts.runtime.logproviderbase.validate.aspx
...I guess that simply means that I can't access a package's variables within a custom log provider? Can anyone comment/confirm? Any other options/routes to achieving the same..?
We live in hope,
Tamim.
View 3 Replies
View Related
Oct 1, 2007
As far as I can make out it is not possible to access the variables collection from a custom log provider.
I'm interested to know what the rationale for this is. Why aren't the variables available for logging purposes?
Thanks
Jamie
[Microsoft follow-up]
View 6 Replies
View Related
Feb 21, 2007
I'm running rs2005 sp2, and the dll was made with .net 1.1. Before, there were no issues with this version crossing of .net 1.1 and 2.0.
In the RS IDE, the webservice call works fine. I've read that this execution is done with full trust - so I've tried to tackle the CAS issue.
When I try to call the webservice from the dll, I catch the exception, and it's:
Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Now what confuses me is, why is the version of WebPermission 2.0 when the dll is 1.1? Maybe there is translation done and the dll is really run w/ the 2.0 framework?
Anyways, this I've done are:
* Added this right before my webservice call. Is something missing?
// We need to ensure that this library is permitted to access the webservice url
// http://support.microsoft.com/default.aspx?scid=kb;en-us;842419
System.Text.RegularExpressions.Regex urlRegEx = new System.Text.RegularExpressions.Regex(@"http://server/.*");
System.Net.WebPermission p = new System.Net.WebPermission(NetworkAccess.Connect, urlRegEx);
p.Assert();
* Gave the 'All_Code' group permission of full trust in both .net 1.1 and 2.0 configurations to see if it helped - it did not, and I checked the report after I did an iisreset. This should have done it!!
* I also tried changing: rsmgrpolicy.config and rssrvpolicy.config
and updated these lines to have version 2.0.0.0:
<SecurityClass Name="SecurityPermission" Description="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="WebPermission" Description="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
iisreset was done, and the code executed was still complaining about the permission request failing for WebPermission.
* These blocks were added to rsmgrpolicy.config and rssrvpolicy.config, in respective sections:
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="CompanyPermissionSet"
Name="CompanyRS"
Description="">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="file://C:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportServer/bin/Company.RS.dll"/>
</CodeGroup>
<PermissionSet class="NamedPermissionSet"
version="1"
Name="CompanyPermissionSet">
<IPermission class="SecurityPermission"
version="1"
Flags="Assertion, Execution"/>
<IPermission class="WebPermission"
version="1">
<ConnectAccess>
<URI uri="http://server/"/>
<URI uri="http://*.Company.com"/>
</ConnectAccess>
<AcceptAccess>
<URI uri="http://server/"/>
<URI uri="http://*.Company.com"/>
</AcceptAccess>
</IPermission>
</PermissionSet>
View 1 Replies
View Related
Mar 25, 2008
We use reporting services to report on our SQL 2005.
I wanted to have a function that translates a filter (parameter) in one RDL from IDs to Names to be able to show a summary of what the user selected when he executed the report.
Instead of writing this function in the .Code, I said great, lets use custom assemblies.
PROBLEM: I see examples on how to enable a function in such dll access to DB, but they all hardcode the connection string in the vb code. that seems useless to me. Each customer will have different server name, I need to get the connection string from the sme (shared data source) used in the catalog's folder. just like the RDl is using it. how do I do that?
View 1 Replies
View Related
May 30, 2007
Hi guys,
I have following query in stored procedure Select ContractId, Version, CreateDate, body, IsCurrentFrom CRM_Contracts where ContractId=@ContractId I am trying to access the value of IsCurrent field in Code behind using sqlDataSource to hide a radiobutton list in Formview control's when it is in Edit Mode. How can i do this.
View 1 Replies
View Related
Jan 3, 2008
Does anyone have code to access data? I want to create a sqldatasource control on the page, but would like to programmatically/manually/code-behind-wise to fill in my queries and their parameters. Thanks!
View 6 Replies
View Related
Nov 20, 2007
I have the following datasource...
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ***%>"
ProviderName="<%$ ***%>" SelectCommand='SELECT "var1", "var2", "var3" FROM "tbl1"'>
</asp:SqlDataSource>
Would it be possible to use VB code to read the reasults from this datasource? (There are conditions that restrict me from running the query itself through VB code.)
As always, any help is greatly appreciated. Thanks!
View 1 Replies
View Related
Nov 21, 2006
Hi
I am not able to access SSIS variables which are defined at Data Flow Task in a custom component. This custom component is developed by me in C#. How can i access these variables?
Please let me know if theres a way to access SSIS variables.
Thanks,
Vipul
View 10 Replies
View Related
Dec 9, 2006
Hi All,
I have created a stored procedure (in SQL Server 2005 - Developer) with input and output parameters. Please somebody let me know how I can call this store procedure from code behind using TableAdapter i.e. through XSD.
Thanks,
Long Live Microsoft ;)
View 4 Replies
View Related
Feb 8, 2007
I'm accessing my report through a URL:
http://reportserver/ReportServer?/Folder/ReportName&rs:Command=Render&rs:Format=CSV&rc:Parameters=true
I am getting an error: This report requires a default or user-defined
value for the report parameter 'beg_dt'. To run or subscribe to this
report, you must provide a parameter value.
(rsReportParameterValueNotSet) Get Online Help
I do not want to pass the report parameters (to and from dates) through
the URL. I want the dates to be entered by the user running the
report. If I enter default parameters in Report Manager I am not prompted
for the dates.
View 1 Replies
View Related
May 17, 2007
I am trying to use custom code on a report which is:
Public Function Percentage(decValueOne As Double, decValueTwo As Double) As Object
If (decValueOne = 0 Or decValueTwo = 0) Then
Percentage = 0
Else
Percentage = (decValueOne - decValueTwo)
End If
End Function
In my textbox I have:
=Code.Percentage(SUM(Fields!PreviousYTDExpenseAmount.Value, "Template_OutputData_Sales"), SUM(Fields!PreviousYTDExpenseAmount.Value, "Template_OutputData_CGS"))
When I run the report in design mode, I get the "#Error" on that report field.
Any help with why this is happening would be greatly appreciated!
View 2 Replies
View Related
Mar 21, 2007
Hey guys I have a problem I am trying to solve using custom code but I am open to other solutions.
Situation: I have multiple reports that the user can see. Example (Move In Corp. report, Move In Region report,Move In Division report, Mid Year Corp. report, Mid Year Region report,Mid Year Division report etc.) I have a stored procedure that returns all the information needed based upon the UserID being passed from the report to the stored procedure.
Goal: When the user logs in I want to be able to foward the user to a specific report based upon their userid (global in RS). I currently have three textboxes(Move In, Mid Year, Year End) with navigation enabled to jump to another report. The report to which the user is passed to is determined by an expression which is something like this for the Move In text box =IIF(Fields!orgtypeid.Value = 1,"Move In Corp","Move In Region"). The orgtypeid.value is returned by the stored procedure. I want to be able to forward the user a specific Move In report (Move In Corp, Move In Region, etc) without having the user select the textbox.
Any suggestions are greatly appreciated.
View 3 Replies
View Related
Oct 24, 2007
Hello, this is probably a pretty easy one. I have made a report, and added custom code in the code tab on the report properties. But when I type code.whatever in a text box expression my function does not show. Does anyone know what I am doing wrong?
Thanks
View 3 Replies
View Related
Sep 6, 2007
I am trying to access HttpContext.Current in my report code section (report properties) since I have to look at a cookie. However, HttpContext.Current is always null. Has anyone managed to access HttpContex.Current from a report?
Thanks in advance.
View 1 Replies
View Related
Jun 8, 2007
I am trying to find ways around the limitation of not being able to resize columns based on the text input. I am dynamically setting what values a column is getting from my query. I am wondering if I can access the table (and thus, the columns) from within the custom code.
For example:
Public Function Whynot() As Integer
Report.table1.TableColumn1.Width = ....
table1.TableColumn.Width = ....
Return 0
End Function
Neither of these seem to work, anyone else have any ideas?
Thanks
View 2 Replies
View Related
Jun 11, 2007
Is it possible to do a redirect to an arbitrary page in by using custom code?
eg.
Public sub myRedirect()
response.redirect(http://www.microsoft.com)
End sub
/Alex
View 1 Replies
View Related
Feb 21, 2008
I developed a ConnectionString assembly in custom code a while back. Now it won't work. I've changed boxes since. My question is do I have to have SQL Server and Reporting Services on my development machine to run Custom Code assemblies?
I put my dll in the PublicAssemblies folder. I see that I need to put my dll in C:Program FilesMicrosoft SQL Server80ToolsReport Designer but I don't have that folder.
When I try and set the ConnectionString to "=ReportingLibrary.ReportingLibraryFunctions.ConnectionString(User!UserID)", I get "Unrecognized Identifier." I checked the reference and it was still there from when the project was working before.
Code Snippet
using System;
using System.Security.Permissions;
using System.Configuration;
namespace ReportingLibrary
{
public class ReportingLibraryFunctions
{
public static string ConnectionString(string userName)
{
System.Data.SqlClient.SqlClientPermission oPerm = new System.Data.SqlClient.SqlClientPermission(PermissionState.Unrestricted);
oPerm.Assert();
string catalog;
string query;
string connectstring;
string datasrc = String.Format("Data Source={0};", ConfigurationManager.AppSettings["DataSource"]);
string userpwd = String.Format("User ID={0};Password={1};", ConfigurationManager.AppSettings["DBUsr"], ConfigurationManager.AppSettings["DBPwd"]);
query = "SELECT TOP 1 MyAcctKey FROM dbo.MyUserAcct WHERE UserName=@username;";
connectstring = String.Format("{0}Initial Catalog=MyMaster;", datasrc);
System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(String.Format("{0}{1}", datasrc, userpwd));
connection.Open();
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(query, connection);
command.Parameters.Add("@username", System.Data.SqlDbType.VarChar);
command.Parameters["@username"].Value = userName;
catalog = String.Format("MyDb_{0};", command.ExecuteScalar());
connectstring = String.Format("{0}Initial Catalog={1}", datasrc, catalog);
connection.Close();
return connectstring;
}
}
}
View 9 Replies
View Related
Oct 19, 2007
I have been stuck in a problem for a while now. I am trying to count the number of groups. I tried soo many things and nothing worked . Now I want to try to write a function that does the counting for me.
Can somebody write me an example of a cutom code that can be called from expression.
So my custome code should be something like that
Public int CountFun(int counter)
{
Return counter= counter +1;
}
Also how do I call this method from my expression?
i am going to call it from a field inside the groups, so each time the group is implemented i add one to the counter.
thanks
View 4 Replies
View Related
Sep 19, 2007
Is it not possible to have nested ifs in a custom code function? I keep getting an error message when I try it.
View 1 Replies
View Related
Oct 3, 2006
I'm using a GAC-installed assembly as part of a Reporting Services
(2005) report. The code does not need any permissions beyond execution.
All it does it take today's date and calculate last week's start and
end date. It's all just datetime manipulations. All methods are static.
In
the VS2005 report designer, I can do everything fine. The code runs as
expected and defaults the parameters to the right date.
When I
upload the rdl to the Report Server, I get the message "Error during
processing of €˜Start€™ report parameter.
(rsReportParameterProcessingError) ". If I override the "Start"
parameter, it doesn't give me that error anymore. Start should be the
Sunday of the previous week.
I have deployed the signed assembly to the GAC on the report server as well as the bin folder for reporting services. Because it doesn't need anything beyond execution, I shouldn't have to modify any config files, right? I have already restarted IIS & the Reporting Services service.
What am I missing?
View 10 Replies
View Related
Jun 25, 2007
Hello everyone,
I've got an issue where I want to sum the group values and not the details, the reason is because I am hiding duplicate records. Here's how my Layout is setup.
TH
GH1 (hidden)
GH2 (hidden)
Det (hidden)
GF2 =Code.AddValue(Fields!Quantity.Value * Fieds!Cost.Value)
GF1 =Code.ShowAndResetSubTotal()
TF =Code.GrandTotal
I have the following in my Code window.
Dim Public SubTotal as Decimal
Dim Public GrandTotal as Decimal
Function ShowAndResetSubTotal() as Decimal
ShowAndResetSubTotal = SubTotal
SubTotal = 0
End Function
Function AddValue(newValue as decimal) as Decimal
SubTotal += newValue
GrandTotal += newValue
AddValue = newValue
End Function
This gives me incorrect results and I can't figure out why. Here's how it shows on my report:
Part Number
Quantity
Cost
Regular Subtotal Method
Using Custom Code
Part 1
4,000
1.49
$5,947.20
Customer 1
$11,894.40
$0.00
Part 2
10
1.01
$10.07
Customer 2
$50.34
$5,947.20
Part 3
1
0.44
$0.44
Part 4
6,050
0.25
$1,530.41
Part 5
0
1.25
$0.00
Part 6
0
1.23
$0.00
Customer 3
$42,851.86
$10.07
Part 7
16,250
0.24
$3,922.59
Customer 4
$19,612.94
$1,530.85
Part 8
17,250
0.38
$6,544.82
Part 9
27,225
0.20
$5,380.20
Customer 5
$66,891.69
$3,922.59
Grand Total
$141,301.23
$0.00
The issues brought up from the duplicates is shown in the "Regular Subtotal Method" column (there are 2 detail records for Customer 1-Part 1, which is why it is doubled). I can't use a distinct on the SQL query because there are other fields (not shown) on the report that are different.
As you can see, the GF1 (Customer #) shows the subtotal from the previous group, and the Table Footer (Grand Total) shows 0. Why is this?
Jarret
View 2 Replies
View Related
May 30, 2006
Hi guys,
i was developing some custom code to do a running total in a matrix, and i have noticed some odd behaviour with the InScope function. I am doing year on year reporting, so i have two row groups on my matrix: the first is on month (matrix2_Calendar_Month), the second on year (matrix2_Calendar_Year).
I needed to total the number of days covered by the months i was reporting on, so i wrote some very standard code to do this, along with an expression in that column of the matrix:
=IIf(
InScope("matrix2_Calendar_Year"),
CStr( Round( Sum(Fields!Sales.Value / (24 * Code.AddDays( CStr(Fields!Calendar_Month.Value), CInt(Fields!Calendar_Year.Value))), 2)) ,
Code.getBounds()
)
Code.AddDays() calculates and returns the number of days in the month of that year on that row. Code.getBounds simply returns the lower and upper bounds of the array, plus its contents (so i can inspect them). This is what is returned in the report:
Month / Year
Sales
Capacity
% Capacity
Avg $/h
February
2006
3842
7706
49.86%
2.86
2007
0
0
0.00%
0
March
2006
4949
8692
56.94%
3.33
2007
0
0
0.00%
0
April
2006
5160
8154
63.28%
3.58
2007
0
0
0.00%
0
May
2006
3309
8348
39.64%
2.22
2007
0
0
0.00%
0
Total
17259
32900
52.46%
0-8*28,28,31,31,30,30,31,31,28
If you look at the output in the total row, you will see that Code.AddDays() has been called one extra time at the end, with Feb 2006 as its parameters, thus adding an extra 28 days to the running total. Why is Code.AddDays called on the total row, when i should be out of the scope of both the row groups? (Note: this happens for whichever row group i use in the InScope check in the expression).
Here is the custom code used for all this:
Dim numDays()
Public Function AddDays(ByVal month As String, ByVal year As Integer) As Integer
Dim thisMonth As String
Dim upper As Integer
upper = 0
On Error Resume Next
upper = UBound(numDays) + 1
ReDim Preserve numDays(upper)
thisMonth = CStr(year) & "-" & month & "-01"
numDays(upper) = DateDiff("d", CDate(thisMonth), DateAdd("m", 1, CDate(thisMonth)))
AddDays = numDays(upper)
End Function
Public Function TotalDays() As Integer
Dim lower As Integer
Dim upper As Integer
lower = 0
upper = 0
On Error Resume Next
lower = LBound(numDays)
upper = UBound(numDays)
TotalDays = 0
Dim ii As Integer
For ii = lower To upper
TotalDays = TotalDays + CInt(numDays(ii))
Next
End Function
public function getBounds() as string
getBounds = Cstr(LBound(numDays)) & "-" & CStr(UBound(numDays)) & "*" & Join(numDays, ",")
end function
sluggy
View 5 Replies
View Related
May 6, 2008
I have a custom C# assembly that my report is calling with embedded code that is called from fields in a reporting services table. The value comes back fine, but I need some of the values to be indented, so I have tried all of the following and every time the spaces are cut off. Spaces work when not using embedded code.
I tried the following in the table cell
=Space(3)+Code.<<String Function Name>>
and I tried
=" "+Code.<<String Function Name>>
Then I tried the code in the assembly and in the embedded code with the same result. No matter where I put the spaces they get cut off. Any ideas? I tried characters other than spaces and they came back fine.
Thanks,
Adam
View 5 Replies
View Related
Jun 14, 2007
I created a stored procedure (see snippet below) and the owner is "dbo".
I created a data connection (slcbathena.SLCPrint.AdamsK) using Windows authentication.
I added a new datasource to my application in VS 2005 which created a dataset (slcprintDataSet.xsd).
I opened up the dataset in Designer so I could get to the table adapter.
I selected the table adapter and went to the properties panel.
I changed the DeleteCommand as follows: CommandType = StoredProcedure; CommandText = usp_OpConDeleteDirectory. When I clicked on the Parameters Collection to pull up the Parameters Collection Editor, there was no parameters listed to edit even though there is one defined in the stored procedure. Why?
If I create the stored procedure as "AdamsK.usp_OpConDeleteDirectory", the parameters show up correctly in the Parameters Collection Editor. Is there a relationship between the owner name of the stored procedure and the data connection name? If so, how can I create a data connection that uses "dbo" instead of "AdamsK" so I can use the stored procedure under owner "dbo"?
Any help will be greatly appreciated!
Code SnippetCREATE PROCEDURE dbo.usp_OpConDeleteDirectory
(
@DirectoryID int
)
AS
SET NOCOUNT ON
DELETE FROM OpConDirectories WHERE (DirectoryID = @DirectoryID)
View 1 Replies
View Related
Jun 26, 2006
I'm trying to run a DTS package, and cant find an easy direct way to run it. It seems like the easiest solution would be to throw a custom error- then the server notices the error and runs a custom job, and the custom job runs the DTS. This is a roundabout way, but seems like it would be the simplest solution.Anyways, how do I throw the error in my code? Do I just write a throw 3829 statement? Also maybe this is a very bad way to do this- any suggestions?
View 2 Replies
View Related
Oct 3, 2006
Is it possible to write custom code that achieves the same thing as an aggregate function?
ex: Calculating the sum of a group? (with out using the sum( field!one.value) function)
if I had a group that grouped on name.
Name Number
header Fields!FirstName.Value ************
details Fields!Number.Value
footer
Can i write a custom code function (or functions) that will get the sume of the numbers in that group.
Thanks in advance.
View 7 Replies
View Related
Apr 2, 2008
Hi,
Is it possible to connect to a database and fetch data from it from within custom code inside a report?
Appreciate any help.
Regards,
Asim.
View 4 Replies
View Related
Jun 6, 2007
Hello,
Is it possible to add a multivalued parameter to a report from C#? I already have a C# .dll which I reference in the report. If so, could someone give some hints on how to do it?
As I searched the net for an answer to this, I came across ReportExecutionService. It looks like it's what I want, but I cant find the dll to reference in order to used this class. Does anyone know?
If it is not possible to do this from C#, then can someone please give an example on how to do it from Custom Code?
Thanks
/Peter
View 1 Replies
View Related
Apr 21, 2007
HI all, I am having a problem while trying to create a list item through SSRS.The scenario:I have created a SSRS report which has custom code. the report has some parameters. The code accepts the parameters and tries to create a list item in moss. I have added the required references. This works fine as long as I work in VISUAL STUDIO IDE. When I deploy the report to report server it throws an error in the code.Can anybody help me in this...?Regards...
Girija Shankar
View 1 Replies
View Related