logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Kyrie  
#1 Posted : Friday, April 8, 2022 1:38:41 AM(UTC)
Kyrie

Rank: Newbie

Groups: Registered
Joined: 4/1/2022(UTC)
Posts: 1
Taiwan, Province Of China
Location: Taiwan

Hello

I have two Date/Time type Restrictions in my report, Both of the Restrictions back time value I set Operator with 'Is between' AND the back value set up the time for 23:59:59 like this code in my `Pre Load Script`,

Code:

@using System.Data
@{
    ReportModel model = Model;
	ReportExecutionLog log = model.Report;
    List<ReportElement> elements = model.Elements;
    List<ReportRestriction> restrictions = model.Restrictions;
    var time = new DateTime(1,1,1);
    var commenttime = restrictions.FirstOrDefault(m=>m.Name == "commenttime");
        if(commenttime != null) {
           if(commenttime.Date2 != null){
              commenttime.Date2 = new DateTime(commenttime.Date2.Year,commenttime.Date2.Month,commenttime.Date2.Day,23,59,59);
              }
            }
    var replytime = restrictions.FirstOrDefault(m=>m.Name == "replytime");
        if(replytime != null) {
           if(replytime.Date2 != null){
              replytime.Date2 = new DateTime(replytime.Date2.Year,replytime.Date2.Month,replytime.Date2.Day,23,59,59);
              }
            }
}



And the second Restrictions I need to set the empty Value , but when I was execute the report , the second Restriction's back value became '0001/1/1 23:59:59' automatically

How can I solve it??

epf  
#2 Posted : Saturday, April 9, 2022 5:57:53 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
I made a quick sample with Northwind and this seems to work.
you can find it in attachment sample date.srex (8kb) downloaded 4 time(s).
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.