Arwin van der Laan [NL]


Hi,

We are developing a custom report item but we cannot find a way to get the report parameters. In Vb examples there is mentioning of globals but these do not seem to be present in the c# enviroment.

Could anyone give a solution on how to get to the report parameter collection in run-time.

Thanks,

Arwin van der Laan




Re: Custom Report Item and Parameters in c#, how do I get them

GregSQL


This may help you:

ReportViewer1.ServerReport.GetParameters();







Re: Custom Report Item and Parameters in c#, how do I get them

Arwin van der Laan [NL]

Greg,

Thanks for the help but it does not do the job as far as i can see.

Maybe this makes my question more clearly.

During the process event of the runtime part of the custom report item we need to hold a report wide string for state purposes, beside that one we need to get the user_id which we will add to the parameters requesting the report.

Arwin






Re: Custom Report Item and Parameters in c#, how do I get them

Lisa Nicholls

Whether your code is written in C# or VB should have no bearing on this.


I've written a couple of custom report items. I am not sure whether you are writing a "custom report item" exactly, from what you are saying here, or a "custom report logic DLL (assembly)" for use in processing.

If the latter, can you check this thread http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1755679&SiteID=1, which I think may help you

If the former, can you talk a bit about your report item's API, and what you're trying to do/what's not working for you

>L<






Re: Custom Report Item and Parameters in c#, how do I get them

Arwin van der Laan [NL]

Lisa,

Thanks for your answere, I looked into the thread you referenced but I still can get what I want.

Below there is a sample of what we want to do, in het process event we want to get hold of the report parameters and some kind of report string variable so multiple report items can use it.

Code Snippet

public class ReportItemBasic : ICustomReportItem

{

private CustomReportItem m_CustomReportItem;

private Microsoft.ReportingServices.ReportRendering.Image m_BasicImage;

private Microsoft.ReportingServices.ReportRendering.ImageMapAreasCollection m_ImageMap;

protected static string propertyClass = "Basic";

public CustomReportItem CustomItem

{

set

{

m_CustomReportItem = value;

}

}

public ReportItem RenderItem

{

get

{

if (m_BasicImage == null)

{

}

Process();

}

// Get report parameters and extract user id and application autorisation

// string id_User = ...

// global:appAut = ........

return m_BasicImage;

}

Besides the fact that reporting services is a new area for us is that I am just started with c# (former delphi & vb).

Arwin





Re: Custom Report Item and Parameters in c#, how do I get them

Lisa Nicholls

Ah! The thread I sent you to will not help you because you really *are* using a custom report item, not doing custom report processing (I really wasn't sure before and very few people are doing the former <s>).

>> I am just started with c# (former delphi & vb)

It really is important to realize that you should be able to do this in whatever language you want, and that should include delphi.net <g>, but FWIW I think they test most everything of this nature in c# first <g>.

First, where is the vb sample that you are working from and trying to emulate I think there was a custom report item in RS 2000 but it changed a lot so it's important to make sure you're not using an old sample, regardless of language.

Now, I have two mostly-separate things to tell you <s>:

1. I think the best way to do what you want to do is to use a custom property to hold the report parameters item you want.

I assume that you have been working from either the Polygons CRI sample or maybe the article by Teo Lachev in MSDN that is based on the Polygons sample That's how I got started. You will see that the Polygons item has a custom property like this:

<CustomProperty>
<Name>polyBig SmilePI</Name>
<Value>=Parameters!DPI.Value</Value>
</CustomProperty>

... so clearly it is one way to get access to the parameters. You will see other custom properties that are expressions basd on data elements in the report.

2. What you said about "so multiple report items can use it" happens to touch on a subject very near and dear to my heart with regard to custom report items. <s> I have posted something about what I have been working on here http://spacefold.com/articles/XMLRSDocs.aspx, but what you can't see in what I've written so far is the design choices that I made as a result of what a custom report item can and cannot do.

We can take this conversation off-line or off-forum if you like and I can be more specific. Basically as you'll see in what I've written already it is quite important in my scenario that one custom report item have some bearing on the rest of the report but it is not something that was envisioned by MS. In fact, I thought originally that I wanted to work solely on the Report level rather than using a customreportitem at all for what I wanted to do -- but this turned out to have its own difficulties. I haven't had a chance to write about this yet.

>L<






Re: Custom Report Item and Parameters in c#, how do I get them

Arwin van der Laan [NL]

Lisa,

This was what I was looking for, thanks.

As far as the concept "so multiple report items can use it" is concerned, yes I am interested in the design choices and your point of view regarding custom report items.

Where do you propose to take the discussion off-forum By e-mail or on spacefold.com

Arwin





Re: Custom Report Item and Parameters in c#, how do I get them

Lisa Nicholls

You can contact me there (spacefold) and we'll continue e-mali as needed.

Either way, you can explain your reason to have one report item touch the lives of other ones -- I think mine is pretty clear in the docs for the utility I'm writing <s> -- and, I'll tell you what I know about the limitations that might affect you.

I do want to continue to write more stuff about this publicly, and if you are free to comment on it publicly, I would prefer to do that. I think that it will turn out to be generally helpful. I am sure that you and I are not the only people who have thought about this approach. But if we need to bring the discussion to e-mail I would certainly not divulge any details of your project in anything I write publicly. OK

>L<