Rick Rick - 7 months ago 13
SQL Question

get data into report ssrs

I'm working on my first SSRS report project and I'm a bit confused. I've design my own custom report that looks exactly like my invoice template in Excel. My goal is to have this invoice/report in a schedule to send out to customers on a monthly basis.

However, my problem is getting the data into the fields of my report. I've been using tables to insert data but it is not working out so well. I created a data set with the following query:

SELECT CONVERT(VARCHAR(10), GETDATE(), 103) AS [DD/MM/YYYY]


The column:
DD/MM/YYYY
does not exist in my database, but it is simply to get the current date. I am receiving an error saying:


The value expression for the field:SELECT CONVERT(VARCHAR(10),
GETDATE(), 103) AS [DD/MM/YYYY] contains an error. Expression Expected


There are some other calculation I would like to do for other parts of the report. So my question is, does the data I want to put into my tables have to be a column in my database? or can I create them using SSRS? Thanks

Answer

Please go through the link to understand how to create datasets and populate date on to your reports

Working with Datasets

The steps to create a dataset which retrieves current date is

1.Create a new dataset .Go to the data tab of your report and click on the drop down menu and select < new Dataset >

  1. A dialog box will appear where u need to enter the SQL query New DataSet

3.When u click ok ,you will see the newly created dataset in the dataset windows

DataSet

4.You can execute the sql query just to verify whether you are getting the current date or not .

5.Then in the Layout panel drag a Textbox in the header and then drag the column from the newly created dataset into it or you can write an expression

  =First(Fields!DD_MM_YYYY.Value, "GettingDate")

There is another way of getting the current date and time from SSRS itself instead of creating a dataset .You can use the inbuilt date and time functions in the SSRS .

Inbuilt Date Functions

Comments