How to pass object as report parameter

7 posts, 0 answers
  1. Per Anders Tidemandsen
    Per Anders Tidemandsen avatar
    5 posts
    Member since:
    Nov 2009

    Posted 16 May 2011 Link to this post

    I have a method which accepts input as object. How can I pass object values as report parameter value.
  2. Hrisi
    Admin
    Hrisi avatar
    221 posts

    Posted 19 May 2011 Link to this post

    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
  3. DevCraft banner
  4. Guven
    Guven avatar
    2 posts
    Member since:
    Jul 2011

    Posted 25 Oct 2011 Link to this post

    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.
  5. Hrisi
    Admin
    Hrisi avatar
    221 posts

    Posted 27 Oct 2011 Link to this post

    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.

  6. Guven
    Guven avatar
    2 posts
    Member since:
    Jul 2011

    Posted 28 Oct 2011 Link to this post

    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;
    }

  7. Hrisi
    Admin
    Hrisi avatar
    221 posts

    Posted 31 Oct 2011 Link to this post

    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.

  8. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 04 Nov 2011 Link to this post

    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
Back to Top
DevCraft banner