Setting the timezone for datasets in page reports

Posted by: mschmitz on 4 June 2020, 8:37 pm EST

    • Post Options:
    • Link

    Posted 4 June 2020, 8:37 pm EST

    I’m running Active Reports 11 in Visual Studio 2013

    In oracle we have some fields that are in a type called “TIMESTAMP(6) WITH LOCAL TIME ZONE” which displays the time to the user according to their session timezone. I’m trying to get the datasets of page reports to not use the default session timezones which can be done with a command like this:

    ALTER SESSION SET TIME_ZONE = ‘US/Eastern’;

    I’ve dealt with this problem before in section reports. I was able to get it working within section reports by setting the session timezone before executing the query and then assigning it to the reader like this:

    
                    conn = new OracleConnection(loConnectionString);
                    conn.Open();
    
                    OracleCommand cmd;
    
                    cmd = new OracleCommand("ALTER SESSION SET TIME_ZONE = '" + parameterlist.GetConfigValue("AGENCY_TIME_ZONE") + "'", conn);
    
    
                    reader = cmd.ExecuteReader();
                    ReportQuery = WhereStrings;
                    cmd = new OracleCommand(ReportQuery, conn);
                    reader = cmd.ExecuteReader();
                    if (!reader.HasRows)
                    {
                        MessageBox.Show("No data found for given parameters.");
                        this.DataSource = null;
                        return;
    
    
                    }
                    this.DataSource = reader;
    
    

    But I’m not sure how or if it can be done with page reports. What I’m trying to find is a way to get the connection of the dataset to execute the command to set its timezone before whatever query it would normally execute next.

    Maybe something similar where I can open the connection in code, execute the command, then hand it off to the page report? Or maybe there’s an event that gets triggered by the dataset that I can access in code to tell it to execute the command before its query?

  • Posted 5 June 2020, 1:12 am EST - Updated 30 September 2022, 5:11 pm EST

    This is close, if I set the data source to be a single transaction then put the ALTER SESSION SET TIME_ZONE into the first data set. The second data then shows data in whatever time zone I set the session too. Ideally I’d need it to be a process less visible to the user though

  • Posted 8 June 2020, 3:08 am EST

    Hello,

    I am glad that your issue has been resolved. Please if you have any other query related to this, please let me know.

    Also, AR11 is a legacy product now. It is out of maintenance mode now. Hence, we do not provide support for the same or no bug fixing will be done in the same. I would recommend you use the latest version of ActiveReports i.e ActiveReports 14. Please refer to the following link for more information: https://www.grapecity.com/activereports.

    Thanks,

    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels