Accessing .NET properties of objects in Expressions

2 posts, 0 answers
  1. Magnus
    Magnus avatar
    10 posts
    Member since:
    Nov 2015

    Posted 25 Oct Link to this post

    Hello,

    I am trying to display the total time span in seconds for a report with two parameters; From (DateTime) and To (DateTime). The subtraction between two DateTime objects is a TimeSpan object, but the following expression fails, claiming that it cannot interpret '.':

    =(Parameters.To.Value-Parameters.From.Value).TotalSeconds

     

    Is there an alternative syntax I can use, or is this kind of expression just not supported? 

     

    Best regards, 

    Magnus

  2. Stef
    Admin
    Stef avatar
    3036 posts

    Posted 25 Oct Link to this post

    Hi Magnus,

    You can use an expression as follows, where variable are of DateTime type:
    = Parameters.Parameter2.Value.Subtract(Parameters.Parameter1.Value)

    The expression uses the access to Datetime methods, Subtract method in the example.

    Regards,
    Stef
    Telerik by Progress
    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 Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top