This is a migrated thread and some comments may be shown as answers.

How to pass object as report parameter

8 Answers 1176 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Per Anders Tidemandsen
Top achievements
Rank 1
Per Anders Tidemandsen asked on 16 May 2011, 11:05 AM
I have a method which accepts input as object. How can I pass object values as report parameter value.

8 Answers, 1 is accepted

Sort by
0
Hrisi
Telerik team
answered on 19 May 2011, 03:07 PM
Hello Per Anders Tidemandsen,

In most places where the Report needs customization you can use expressions. Thus main purpose of Report Parameters is to be used in expressions. They have a type which belongs to the common primitive types. Because we do not know what are your exact needs, we suppose you can add additional report members - fields or properties and use them to pass object between your methods.

Regards,
Hrisi
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Guven
Top achievements
Rank 1
answered on 25 Oct 2011, 11:48 AM
How can i use Expressions as an object parameter ? Can you please give an example ? I have a report class library and i am using it on my silverlight application. I want to pass object parameters as parameter values.
0
Hrisi
Telerik team
answered on 27 Oct 2011, 05:12 PM
Hi Guven,

Telerik Reporting expressions can use Report Parameters. See my previous post where I explicitly say that they have a type which belongs to the common primitive types.

And if you want to pass values to the Report Parameters from Silverlight application, please take a look at this KB article.

All the best,
Hrisi
the Telerik team

Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.

0
Guven
Top achievements
Rank 1
answered on 28 Oct 2011, 07:47 AM
Thank you for your reply Hrisi but i think i could not tell you what i really want to ask. I am using entity framework and i have my own classes. I dont want to pass object array, I want to pass an instance of my class as a parameter.Let me give an example;
class MyClass
{
    int Id { get; set; }
    string Name { get; set; }
    MyClass( int id, string name )
    {
        Id = id;
        Name = name;
    }
}
 void reportViewer1_RenderBegin(.................)
{
            List<MyClass> myList = new List<MyClass>();
            myList.Add(new MyClass() { id = 2, name = "test" });
            args.ParameterValues["param"] = myList;
}

0
Hrisi
Telerik team
answered on 31 Oct 2011, 02:15 PM
Hi Guven,

There is no way to pass object as value for the Report Parameter, the supported report parameter types are listed in our documentation. Please review the documentation and should you have a concrete question, let us know.

Regards,
Hrisi
the Telerik team

Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.

0
Stuart Hemming
Top achievements
Rank 2
answered on 05 Nov 2011, 03:30 AM
Guven,

Just a thought, but you could JSON encode you object, pass the string to the report and have the report decode the JSON.

You'd need to either duplicate the object definition in the report Class Library, or have the definitions in a 3rd assembly referenced by both the calling app and the report assembly.

If the objects are relastively simple, it's prolly not worth the effort, but on the other had, it wouldn't be hard to do.

As I say, just a thought.
--
Stuart
0
Cameron
Top achievements
Rank 1
answered on 13 Jan 2020, 09:53 PM
Could you elaborate on this, please? I follow your first and last two sentences. I don't understand the duplication aspect.
0
Cameron
Top achievements
Rank 1
answered on 13 Jan 2020, 09:54 PM
Could you elaborate on this, please? I follow your first and last two sentences. I don't understand the duplication aspect.
Tags
General Discussions
Asked by
Per Anders Tidemandsen
Top achievements
Rank 1
Answers by
Hrisi
Telerik team
Guven
Top achievements
Rank 1
Stuart Hemming
Top achievements
Rank 2
Cameron
Top achievements
Rank 1
Share this question
or