Showing posts with label custom. Show all posts
Showing posts with label custom. Show all posts

Friday, March 30, 2012

Passing Parameter

I've to create an instance reference to my custom assembly by constructor
method.
It works well with a Code into the report .rdl like this:
---
<Code>
Public Obj As MyClass
Protected Overrides Sub OnInit()
dim MyArg as String = 4
Obj = new MyClass(MyArg)
End Sub
</Code>
--
But i need to pass a real parameter so:
Obj = new MyClass(Parameters!MyPar.Value)
it don't work and break with the error
BC30469 "The reference to a member not shared needs a reference to an object"
(I translate this from the italian version.... sorry for my bad english!!!
How can i do'
Thanks a lot.Try using this reference.
Report.Parameters!MyPar.Value
that should work in the Code.section
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Riccardo" <Riccardo@.discussions.microsoft.com> wrote in message
news:A86E7571-051B-4185-A6EF-110FAFBD67DD@.microsoft.com...
> I've to create an instance reference to my custom assembly by constructor
> method.
> It works well with a Code into the report .rdl like this:
> ---
> <Code>
> Public Obj As MyClass
> Protected Overrides Sub OnInit()
> dim MyArg as String = 4
> Obj = new MyClass(MyArg)
> End Sub
> </Code>
> --
> But i need to pass a real parameter so:
> Obj = new MyClass(Parameters!MyPar.Value)
> it don't work and break with the error
> BC30469 "The reference to a member not shared needs a reference to an
> object"
> (I translate this from the italian version.... sorry for my bad
> english!!!
> How can i do'
> Thanks a lot.|||This not works, but the error is changed with a message box:
" Unable to load the assembly expressions. The expression refers to a
nonexistent parameter in the parameters's collection.".
This is not true, becouse the parameter exists.
Can you help me again?
"Wayne Snyder" wrote:
> Try using this reference.
> Report.Parameters!MyPar.Value
> that should work in the Code.section
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Riccardo" <Riccardo@.discussions.microsoft.com> wrote in message
> news:A86E7571-051B-4185-A6EF-110FAFBD67DD@.microsoft.com...
> > I've to create an instance reference to my custom assembly by constructor
> > method.
> > It works well with a Code into the report .rdl like this:
> > ---
> > <Code>
> > Public Obj As MyClass
> > Protected Overrides Sub OnInit()
> > dim MyArg as String = 4
> > Obj = new MyClass(MyArg)
> > End Sub
> > </Code>
> > --
> > But i need to pass a real parameter so:
> > Obj = new MyClass(Parameters!MyPar.Value)
> > it don't work and break with the error
> > BC30469 "The reference to a member not shared needs a reference to an
> > object"
> > (I translate this from the italian version.... sorry for my bad
> > english!!!
> > How can i do'
> > Thanks a lot.
>
>

Monday, March 26, 2012

Passing list values in drill through! URGENT

I have a custom list(say a list for account numbers, account numbers starting with 13 form a group, then starting with 14 form a group and like that)

and then there are tables inside this list. the report will be displayed based on the values of this custom list.

i also have a drill through report for this. now when i pass fields!accountnumber.uniquename for this list only the first of the group values say 130001 is selected..

what shud i do to select the whole grp?

thanks!

Any workaround on this?

|||

R4BI wrote:

Any workaround on this?

Not sure if this will work but you might try Join(Parameters!accountnumber.Value,",")

|||

let me again explain the scenario:

Main report: One list which is group by a field customaccountnumber.

CustomAccountNumber is formed like this: IIF(left(Accountnumber),2) ="13", 130000 grp , IIF(left(Accountnumber),2) ="14", 140000 grp ,IIF(left(Accountnumber),2) ="15", 150000 grp ,other grps)))

All the tables inside the list are displayed based on the CustomAccountNumber.

SubReport: This report has one of the parameter Accountnumber

Now, Currently from the main report navigation property i am passing ""fields!accountnumber.uniquename"" as the value for this parameter then the subreport gets only the first grp value e.g. 130001 if clicked on the table based on 130000 grp.

What to do so that it gets the whole grp of values?

Please look at it.. I am desperately looking for a solution.

Thanks,

|||

Rohit,

Have you found your solution yet? If not, please post your SQL code and I'll try to assist you.

Passing list values in drill through! URGENT

I have a custom list(say a list for account numbers, account numbers starting with 13 form a group, then starting with 14 form a group and like that)

and then there are tables inside this list. the report will be displayed based on the values of this custom list.

i also have a drill through report for this. now when i pass fields!accountnumber.uniquename for this list only the first of the group values say 130001 is selected..

what shud i do to select the whole grp?

thanks!

Any workaround on this?

|||

R4BI wrote:

Any workaround on this?

Not sure if this will work but you might try Join(Parameters!accountnumber.Value,",")

|||

let me again explain the scenario:

Main report: One list which is group by a field customaccountnumber.

CustomAccountNumber is formed like this: IIF(left(Accountnumber),2) ="13", 130000 grp , IIF(left(Accountnumber),2) ="14", 140000 grp ,IIF(left(Accountnumber),2) ="15", 150000 grp ,other grps)))

All the tables inside the list are displayed based on the CustomAccountNumber.

SubReport: This report has one of the parameter Accountnumber

Now, Currently from the main report navigation property i am passing ""fields!accountnumber.uniquename"" as the value for this parameter then the subreport gets only the first grp value e.g. 130001 if clicked on the table based on 130000 grp.

What to do so that it gets the whole grp of values?

Please look at it.. I am desperately looking for a solution.

Thanks,

|||

Rohit,

Have you found your solution yet? If not, please post your SQL code and I'll try to assist you.

sql

Passing list values in drill through! URGENT

I have a custom list(say a list for account numbers, account numbers starting with 13 form a group, then starting with 14 form a group and like that)

and then there are tables inside this list. the report will be displayed based on the values of this custom list.

i also have a drill through report for this. now when i pass fields!accountnumber.uniquename for this list only the first of the group values say 130001 is selected..

what shud i do to select the whole grp?

thanks!

Any workaround on this?

|||

R4BI wrote:

Any workaround on this?

Not sure if this will work but you might try Join(Parameters!accountnumber.Value,",")

|||

let me again explain the scenario:

Main report: One list which is group by a field customaccountnumber.

CustomAccountNumber is formed like this: IIF(left(Accountnumber),2) ="13", 130000 grp , IIF(left(Accountnumber),2) ="14", 140000 grp ,IIF(left(Accountnumber),2) ="15", 150000 grp ,other grps)))

All the tables inside the list are displayed based on the CustomAccountNumber.

SubReport: This report has one of the parameter Accountnumber

Now, Currently from the main report navigation property i am passing ""fields!accountnumber.uniquename"" as the value for this parameter then the subreport gets only the first grp value e.g. 130001 if clicked on the table based on 130000 grp.

What to do so that it gets the whole grp of values?

Please look at it.. I am desperately looking for a solution.

Thanks,

|||

Rohit,

Have you found your solution yet? If not, please post your SQL code and I'll try to assist you.

Passing list values in drill through! URGENT

I have a custom list(say a list for account numbers, account numbers starting with 13 form a group, then starting with 14 form a group and like that)

and then there are tables inside this list. the report will be displayed based on the values of this custom list.

i also have a drill through report for this. now when i pass fields!accountnumber.uniquename for this list only the first of the group values say 130001 is selected..

what shud i do to select the whole grp?

thanks!

Any workaround on this?

|||

R4BI wrote:

Any workaround on this?

Not sure if this will work but you might try Join(Parameters!accountnumber.Value,",")

|||

let me again explain the scenario:

Main report: One list which is group by a field customaccountnumber.

CustomAccountNumber is formed like this: IIF(left(Accountnumber),2) ="13", 130000 grp , IIF(left(Accountnumber),2) ="14", 140000 grp ,IIF(left(Accountnumber),2) ="15", 150000 grp ,other grps)))

All the tables inside the list are displayed based on the CustomAccountNumber.

SubReport: This report has one of the parameter Accountnumber

Now, Currently from the main report navigation property i am passing ""fields!accountnumber.uniquename"" as the value for this parameter then the subreport gets only the first grp value e.g. 130001 if clicked on the table based on 130000 grp.

What to do so that it gets the whole grp of values?

Please look at it.. I am desperately looking for a solution.

Thanks,

|||

Rohit,

Have you found your solution yet? If not, please post your SQL code and I'll try to assist you.

Friday, March 23, 2012

Passing DataSet's into Custom Code

Is it possible to send a DataSet to a Custom code from the report. I am
planning to use .net dll's in my report as a custom code.
ThanksIf you mean an RS dataset you can't because RS datasets are not exposed
programatically. Some workarounds you may consider:
1. Retrieve an ADO.NET dataset in your code using the same query. In other
words, clone the dataset.
2. If the report has a matrix region, you can redirect the matrix region to
read its values from an embedded function. In this way you can populate a
custom data structure, e.g. an Array or an ADO.NET dataset, which you can
pass the external assembly. As a practical example, you may want to look at
my report sample "Sales by Product Category" which collects the matrix
region data in an array and sends it off to an external assembly to get
forecasted sales.
http://www.manning-sandbox.com/thread.jspa?threadID=10383&tstart=0
Hope this helps.
---
Teo Lachev, MCSD, MCT
Author: "Microsoft Reporting Services in Action"
http://www.prologika.com
"aplearner" <aplearner@.discussions.microsoft.com> wrote in message
news:0DC175E9-0ECE-47D1-A266-EA39E238F998@.microsoft.com...
> Is it possible to send a DataSet to a Custom code from the report. I am
> planning to use .net dll's in my report as a custom code.
> Thanks|||What are you trying to accomplish? If you want to calculate additional columns based on data in
previous columns within the same row, look into calculated fields. If you want more control over
the dataset manipulation, you can write your own Data Processing Extension which reads in the
dataset and performs whatever logic you want to do on it prior to submitting the data to the report.
--
Thanks.
Donovan R. Smith
Software Test Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
"aplearner" <aplearner@.discussions.microsoft.com> wrote in message
news:0DC175E9-0ECE-47D1-A266-EA39E238F998@.microsoft.com...
> Is it possible to send a DataSet to a Custom code from the report. I am
> planning to use .net dll's in my report as a custom code.
> Thanks|||For creating your own DPE, start by searching Google Groups [1]. I know there are a few samples out
there.
Without writing a DPE, if you have a dataset with two columns returned (Quantity and Price) and you
need a third column computed (Total), you can either add a column to your table with this
expression:
=Fields!Quantity.Value * Fields!Price.Value
or you can right-click in the Fields window in Report Designer and choose Add Field. You can create
a new computed field named Total and tell it to always have a value equal to the above expression.
To sort, you should attempt to sort the data in the database prior to being sent to the report. If
that isn't possible, look in our Books Online for more information on how to Sort rows shown in
tables.
[1]
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&group=microsoft.public.sqlserver.reportingsvcs
--
Thanks.
Donovan R. Smith
Software Test Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
"aplearner" <aplearner@.discussions.microsoft.com> wrote in message
news:995C993F-D0CE-4224-8F25-29EFE1E555F3@.microsoft.com...
> Donovan
> I have two ques,
> Ques1:
> Can you explain me how to do this[you can write your own Data Processing
> Extension]. My situation is, my dataset would return 6 rows. Before display
> these rows in my report using table, i have to assign one of the column
> values in 6 text boxes.
> Ques2:
> Is it possible to suffle/sort my dataset by perticluar column value[s] prior
> to submitting the data to the report ?
> Thanks in advance
>
> "Donovan R. Smith [MSFT]" wrote:
> > What are you trying to accomplish? If you want to calculate additional columns based on data in
> > previous columns within the same row, look into calculated fields. If you want more control
over
> > the dataset manipulation, you can write your own Data Processing Extension which reads in the
> > dataset and performs whatever logic you want to do on it prior to submitting the data to the
report.
> >
> > --
> > Thanks.
> >
> > Donovan R. Smith
> > Software Test Lead
> >
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> > "aplearner" <aplearner@.discussions.microsoft.com> wrote in message
> > news:0DC175E9-0ECE-47D1-A266-EA39E238F998@.microsoft.com...
> > > Is it possible to send a DataSet to a Custom code from the report. I am
> > > planning to use .net dll's in my report as a custom code.
> > >
> > > Thanks
> >
> >
> >sql

Passing data to a custom component at runtime.

I have a question about what is allowed and what isn't its related to a raneg lookup question (http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=95372) and engine threads (http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=100596).

So one answer to the range lookup is to provide a script component that does the lookup. The challenge is obtaining the data for the lookup. You could write some code that took a sql connection or a flat file connection etc and read the data but that means you are fixed to the connection. Or you could do what I am about to suggest.

If I have a custom component that has 2 inputs. one to take the lookup values and one that takes the flow that contains the values to lookup.

Now the challenge is to get the lookup array populated before processing the other flow. My suggestion is to sleep the process input thread for the main data flow until the buffers for the other input has completed. So is the following good or bad ?

bool bLookupArrayLoaded = false;

public override void ProcessInput(int inputID, PipelineBuffer buffer)
{

bool bCancel = false;


if (inputID == lookupInputID )
{
//Do we have any rows
if (!buffer.EndOfRowset)
{
//Loop through the buffer to load the lookup array
while (buffer.NextRow())
{
//Populate the llokup array
}
}
else
{
//no more rows flag the array loaded
bLookupArrayLoaded = true;
}
}
else
{
//Has the array been loaded, if not sleep
while (!bLookupArrayLoaded ) Thread.Sleep (1000);

//process rows of the main data flow
if (!buffer.EndOfRowset)
{
//Loop through the buffer
while (buffer.NextRow())
{
//do stuff
}
}

}
}

You should not do this. If you mark your output as synchronous then your second input will never be called. If you mark is as asynchronous then it may or may not be called depending on the execution plan and more likely than not it will never get called, although you could test it out for every package you use the component it. I would strongly advise against this approach since it is a deadlock waiting to happen.

Thanks,
Matt|||Thats what I thought. But it works, is suspect because the input with the lookup values isn't synchronous with any output. So a seperate thread is used for that input and another for the other input.

I understand your point, it would be good if this was guaranteed as it means the component can use the power of the SSIS to load data with out the need to understand anything but an SSIS buffer.

I suppose this needs to be one of those items for Best Practice Analyser.

Wednesday, March 21, 2012

Passing Collections to Custom Code

In RS2000 it was possible to pass the entire fields or parameters collection to a custom code function. So for example,

Custom Code:

Function Calc(pFields) as String
Return pfields("fldname1").Value + pfields("fldname2").Value
End Function

Report Expression:
Code.Calc(Fields)

This also worked with the Parameter Fields Collection. It made it possible to move a considerable amount of logic to the custom code section.

In RS2005 this still works in the VS.Net Report Designer but the expression returns an error when the report is viewed through the report manager.

Has anyone else used this in RS2000? Did you get it to work in 2005?

Try the following function - it should work just fine:

Public Function Calc(pFields As Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Fields)
return pFields("name1").Value
End function

-- Robert

|||Thanks, this works. Too bad you can't put an imports statement at the beginning of the custom code section to avoid typing this for every function.|||

Hi we are highly dependent on this sort of thing.

We have created a couple of utility libraries to return needed values.

This worked fine in RS2000 but breaks in RS2005.

Here is a small snippet of the code -

<code>

using Microsoft.ReportingServices.ReportProcessing.ReportObjectModel;

using HermesReportLibrary;

namespace HRA2V2ReportLibrary

{

/// <summary>

/// Methods for determining if Onsite is required

/// </summary>

public class Onsite

{

/// <summary>

/// Determine if onsite needed

/// </summary>

/// <param name="fields">survey record</param>

/// <returns>true if onsite needed</returns>

public static TrueFalse NeedsOnsite(Fields fields)

{

if (Onsite.NeedsOnsiteWithMedical(fields) == TrueFalse.True

|| Onsite.NeedsOnsiteWithTobaccoCounselor(fields) == TrueFalse.True

|| Onsite.HasInjuryPrevention(fields) == TrueFalse.True)

return TrueFalse.True;

return TrueFalse.False;

}

</code>

RS2005 cannot seem to find my custom assembly. In RS2000, I only had to put the assembly in the right directory and it found it. I cannot determine what that directory might be in RS2005. I tried to load the assembly into my instance of the RS2005 database using the SQL2005 Server Management Studio by right clicking on the Programmability\Assemblies folder under that instance and selecting from the pop up menu 'New Assembly' however it will not load because of the following error.

An excepton occured while executing a Transact SQL statement or batch. --> Assembly 'microsoft.reportingservices.processing' version=8.0.242.0, culture=neutral ... was not found in the SQL Catalog. (Microsoft SQL Server, Error: 6503)

How can I get this custom assembly to be loaded by RS2005 or do I need to throw away hours of developer work and start over from scratch to be able to use RS2005.

Thanks guys

|||

Hi, John,

See if this helps -- Deploying a Custom Assembly for RS2005 is described here: http://msdn2.microsoft.com/en-US/library/ms155034.aspx

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Passing Collections to Custom Code

In RS2000 it was possible to pass the entire fields or parameters collection to a custom code function. So for example,

Custom Code:

Function Calc(pFields) as String
Return pfields("fldname1").Value + pfields("fldname2").Value
End Function

Report Expression:
Code.Calc(Fields)

This also worked with the Parameter Fields Collection. It made it possible to move a considerable amount of logic to the custom code section.

In RS2005 this still works in the VS.Net Report Designer but the expression returns an error when the report is viewed through the report manager.

Has anyone else used this in RS2000? Did you get it to work in 2005?

Try the following function - it should work just fine:

Public Function Calc(pFields As Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Fields)
return pFields("name1").Value
End function

-- Robert

|||Thanks, this works. Too bad you can't put an imports statement at the beginning of the custom code section to avoid typing this for every function.|||

Hi we are highly dependent on this sort of thing.

We have created a couple of utility libraries to return needed values.

This worked fine in RS2000 but breaks in RS2005.

Here is a small snippet of the code -

<code>

using Microsoft.ReportingServices.ReportProcessing.ReportObjectModel;

using HermesReportLibrary;

namespace HRA2V2ReportLibrary

{

/// <summary>

/// Methods for determining if Onsite is required

/// </summary>

public class Onsite

{

/// <summary>

/// Determine if onsite needed

/// </summary>

/// <param name="fields">survey record</param>

/// <returns>true if onsite needed</returns>

public static TrueFalse NeedsOnsite(Fields fields)

{

if (Onsite.NeedsOnsiteWithMedical(fields) == TrueFalse.True

|| Onsite.NeedsOnsiteWithTobaccoCounselor(fields) == TrueFalse.True

|| Onsite.HasInjuryPrevention(fields) == TrueFalse.True)

return TrueFalse.True;

return TrueFalse.False;

}

</code>

RS2005 cannot seem to find my custom assembly. In RS2000, I only had to put the assembly in the right directory and it found it. I cannot determine what that directory might be in RS2005. I tried to load the assembly into my instance of the RS2005 database using the SQL2005 Server Management Studio by right clicking on the Programmability\Assemblies folder under that instance and selecting from the pop up menu 'New Assembly' however it will not load because of the following error.

An excepton occured while executing a Transact SQL statement or batch. --> Assembly 'microsoft.reportingservices.processing' version=8.0.242.0, culture=neutral ... was not found in the SQL Catalog. (Microsoft SQL Server, Error: 6503)

How can I get this custom assembly to be loaded by RS2005 or do I need to throw away hours of developer work and start over from scratch to be able to use RS2005.

Thanks guys

|||

Hi, John,

See if this helps -- Deploying a Custom Assembly for RS2005 is described here: http://msdn2.microsoft.com/en-US/library/ms155034.aspx

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Monday, March 12, 2012

passing a dataset in to custom code

Is it possible to pass a dataset in to custom code? You can pass values in
but I was wondering if the whole dataset could be passed in.
Thanks,
CraigHi,
I think instead you can create dataset in the reporting server itself and
access it.
Regards
Amarnath
"Craig" wrote:
> Is it possible to pass a dataset in to custom code? You can pass values in
> but I was wondering if the whole dataset could be passed in.
> Thanks,
> Craig
>
>

Saturday, February 25, 2012

Pass fields as array to custom function?

I created a custom function that accepts an array of strings as a input. I need to pass several fields from the dataset to this function as an array. How can I do this?

You would need to create a function in the code window that accepts the values and inserts them into an array.

ex.

Code Snippet

Function CreateArray(ByVal field1 As String, ByVal field2 As String) As Array
Dim ar(1) As String
ar(0) = field1
ar(1) = field2
Return ar
End Function

I haven't tested it, but I think it will work.

Simone

|||

You can use the Split function.

http://msdn2.microsoft.com/en-us/library/6x627e5f(VS.80).aspx

|||That is true but you would still need to create a string to split using the required fields. Depending on the data those fields contain, you would need to be careful if they hold the delimeter used in the split function.