Make an SSRS Oracle database report that uses time-type parameters.

Source: Internet
Author: User

Demand: We this report is in months, the data presented is the first day of the current month to the last day of the query. Conditions similar to: Time_day > 20140601 and Time_day < 20140630

Because it is to allow the user to select the month, all the time parameters presented should be 201406, write a time of SQL, this is connected to the Oracle database, and only generate data from 201301 to the current month.

?
1 2 3 4 5 6 7 8 select * from (SELECT TO_CHAR(ADD_MONTHS(TO_DATE(‘2013-01‘, ‘YYYY-MM‘), ROWNUM - 1),                ‘YYYYMM‘) DAY_ID   FROM DUAL CONNECT BY ROWNUM <=            months_between(to_date(to_char(sysdate,‘yyyy-MM‘), ‘yyyy-mm‘),                           to_date(‘2013-01‘, ‘yyyy-mm‘)) + 1) order by DAY_ID desc

Made into a dataset.

 

Add a parameter to the parameter.

Select the time collection that we created in the available values. The Value field is the field in the SQL, the Label field is actually displayed to the user to see the field, if you think 201406 this way users may not understand, then to change the SQL, the time format into the user can understand the appearance, the Label field shows the corresponding field, I'm going to pick that value right here. These two parameters need to be hidden, this needs to be noted. Do not present to users for selection

Because the data presented to the user is queried on a daily basis, we are going to convert the time. Add two additional parameters.

Smontime the other is a parameter that was added earlier. Stime because it is the first day, all directly using the "&" symbol to connect 01, an int outside is to convert the value into an int corresponding to the data type of the parameter.

Another parameter is added as well as this parameter, except that the & connection is 31 I'm lazy again, because our backstage data is of type int, so this way I'm using number 31st. It is not right now that it is time.

Another parameter I'll cut a picture, too.

To add a dataset, the red part below is the two parameters above. Oracle uses ":" In a way that SQL SERVER uses "@".

Now insert the table in the report, and right-click the SSRS report body blank to add a table.

Select the inserted table and press F4 to show the related properties of this table, which will usually appear on the right side of the window.

There's a datasetname in the property. This is the data set in this project. Choose one from the inside.

When you return to the table at this point, you will see a drop-down box with the click of the mouse in the cell, which is the field in the dataset you selected.

Make adjustments to the table. The first behavior of the table header, you can make various property modifications to the grid table. Need to find out for yourself.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.