How to launch SSRS report on demand - sql-server-2014-express

We have an application that is inserting data to the SQL Server data base. I have to create a report based on the data from this SQL Server data base.The report should be generated on a demand (by a user click from the application) as a HTML file and saved in a specific folder on a PC.
I think the best way is to use SSRS, but I'm not so familiar with it. I've created a report using Report Builder tool.
How can I create the report on demand each time the user requires it?

You need to have a back-end running on C# to consume SSRS web service. Along with this you will also need to have a .rdl file (template/design) for representing that sql-data.
On click of the button/link you can have a server call to generate that report for you.
Refer : https://learn.microsoft.com/en-us/sql/tutorials/access-report-server-web-service-vb-vcsharp-ssrs-tutorial?view=sql-server-2014
and https://www.codeproject.com/Articles/1110411/How-to-Write-a-Csharp-Wrapper-Class-for-the-SSRS-R

Related

SQL Server and Excel

I want to link an excel file to SQL Server 2014 whereby I can edit the file and the data gets updated on the server automatically.
Similar to what happens when you link sql server to Access whereas you can edit the data and the changes take effect in the server.
Thanks in advance
There is no out of the box solution for this. You can do this either of two ways:
Write a C# code which has a file watcher attached to the Excel file which uploads the Excel file using SSIS job to the database.
Create a scheduled SSIS job which imports the Excel file periodically.
Understanding the purpose would allow for greater elaboration.
This depends on the type of data you wish to edit.
For master data, if you have the Enterprise or Business Intelligence edition of SQL Server and Master Data Services set up, there is a plug-in for Excel:
https://msdn.microsoft.com/en-us/library/hh231024(v=sql.120).aspx
For transactional data, I would strongly advise against using Excel as a front-end and would recommend you to consider alternatives.
However, if you are compelled to go down this route, you can achieve this using VBA scripting and linking via a DAL (Data Access Layer) such as ADO.NET. Be aware that giving such power to your users could open up your system to sql injection attacks - only proceed so if you trust the users 100%. Another thing to take into consideration is validation checks - validation checks should be applied to every cell where data can be entered. More information can be found here:
https://support.microsoft.com/en-us/kb/316934

Sharepoint - Link to a file that is updated Dynamically?

I'm hoping this is possible.
The organization I work for has a Sharepoint site and I am able to Upload Files to pages, however I am not an admin on our Sharepoint. I'm not sure what the version is, I think its older (ie: 2005).
I have some Excel Reports I've built. The data for these reports is pulled from a SQL Server Database which I have full control over. I have setup a Job in SQL Server to run every 12 minutes, this procedure pulls in some data and updates a few tables. These tables are used to feed my Excel Reports.
I have a separate Scheduled task set to open my excel report(s) refresh the data connections and save as a PDF.
I would like to link to these PDF Files via our Sharepoint so that the VIPs can access the reports as they want, but they always see the most up to date report.
I was trying to link to a Shortcut to the PDF Files but SharePoint doesn't seem to like that. How do I make the SharePoint link point to the PDF File that is saved over every 15 minutes?
Thanks in advance,
Any insight is greatly appreciated.
The way I do it (newish version of Sharepoint) is make the save location for the PDF the network location where Sharepoint keeps the files for that site. Usually you'll have access to those if you can edit the Sharepoint site.
Here is a tutorial to find that network location.
EDIT: It very well may be disabled by the admin at the moment. But it looks like the functionality is there.
Given the age of your SharePoint (either 03 or 07), most of the modern tools that you could use to do this don't exist for you (Excel reporting, BI tools, etc). The easiest solution I can think of is to actually modify the other side of the equation. A few options:
Change your report to output two copies of the same file. One entitled (as an example) currentreport.xls and the other report20150626.xls . Put the link to the currentreport.xls in SharePoint.
Build an ASP.net page that runs the SQL query you have built and pull the data through a view. Since this would be pulled on demand, it may be a few more cycles of your SQL code, but indexing, caching and selective data pull can prevent this from being an issue. Put the asp.net code in an iFrame in a SharePoint content editor web part.
Build your report using SSRS and host the output of that in SharePoint using an iFrame.
Run a scheduled job in SQL that copies your current report data to a table and query that table instead of your normal report table. That way you only have one Excel file that points to a specific table so no need to update links. You can always keep copying data to specific files if you need a historical record and can't use the DB to store this data for you (though the amount of space that it would take to do so would be minimal).

Upload VS SSDT Reporting Project to SQL Server Report Builder?

In the past, I have developed SSRS reports using Visual Studio (BIDS/SSDT). Unfortunately, a company server migration has made it impossible for me to deploy my reporting projects using that technology, so it appears I have to resort to Report Builder now.
Others have claimed that the SSRS project-building capabilities of Visual Studio far exceed those of the Report Builder in SQL Server.
What I'd like to know is: Can I develop a Reporting Services project in Visual Studio and then upload it to Report Builder so that it is deployable there? If so, what are the steps to accomplish this, and what, if any, are the drawbacks?
You can manually upload the report files (the .rdl) files to reporting services, either manually or using something like rs scripter.
When you add a report in BIDS/SSDT it creates the rdl which you can deploy - you shouldn't have to use the report builder at all.
This shows how to upload reports using the web ui:
https://msdn.microsoft.com/en-us/library/ms157332.aspx
I was able to use my uploaded.RDL file by opening it in Report Builder.
FYI, the steps to upload the .RDL file are:
Start Report Manager (SSRS Native Mode).
In Report Manager, navigate to the Contents page. Navigate to the folder in which you want to add the report.
Click "Upload File".
Click "Browse" to select the .RDL file to upload. You can also upload image files, or other resources that you want to make available to other reports on the server, rather than embedded in your report.
Type a name for the new item.
If you want to replace an existing item with the new item, select Overwrite item if it exists.
Click OK.
Just note that you may have to modify login credentials in the properties of data source's in your report. In order for the report server to access a database used by your report, you may also need to grant it some privileges in the database.

Epicor Crystal Reports Data

I have a standard crystal report from Epicor loaded into Visual Studio (specifically the purchase order report). Basically I would like to preview the purchase order for order #12345. How can I do this? It seems like the report data source is already setup although it doesn't seem to point to a database. This is the regular report that comes with Epicor. Any ideas? Thank you
The data for Epicor reports comes from a process that queries the database and generates either XML files (E9) or tables in a separate database (E10). As you are using Crystal Reports I assume you are using E9, as it is still supported in E10 but SSRS is standard.
You will need to run the report in Epicor and allow the Task agent to pick up the job to produce the data. You should then be able to use the XML files to provide data to your report designer.

Running Excel automation locally or on server

Wanted some opinions on which method is a better practice. We have a sales report that MUST be generated in a very specific format (down to the row colors and fonts).
I already have written a macro which pulls from our database and populates the entire workbook in about 15 seconds. The question is how should it be populated?
1) Process server-side: Users initiate the request on the intranet page. ASP.NET opens the workbook template, executes the macro and serves back the final sheet.
2) Process locally: Users download the blank template, run from their desktops which automatically connect to the database.
I like the first one because I can enforce the template, timing, users, and security of the data. But is running Excel automation on an internet web server recommended? I like the second option, but I'm afraid of losing standardization as template sheets begin floating around the company.
As for server side:
I highly.. HIGHLY.. recommend checking out the OpenOffice/LibreOffice XML format for spread sheets.
You can use the localc binary in headless mode to convert the XML file to XLSX or what have you. I use it to create PDF files instead of using ReportLab.
Alternatively here are some other projects that attempt to write to Microsoft formats directly:
http://pypi.python.org/pypi/xlrd
http://pypi.python.org/pypi/xlwt
As for client side:
If you expect the user to be only using Excel and not any other spreadsheet software then go ahead and use an ODBC data source. ODBC will have to be configured per user unless you use some fun VBScript to pull the data from an HTTP server every time it is loaded. There is also the option of making an XLS spreadsheet that simply holds the data and including it into an XLS document as well which would be both a server and client XLS requirement.
Go for server side. Makes information simple to archive and share and will most likely be multi-platform as well.
If you like to use your first option, then you want to avoid using VBA on an installed instance of Excel on the server. This is extremely resource intensive and does not scale well. Instead, if you are writing ASP.NET code, then you should try using the Microsoft Office Interop functionality that is built into the .NET framework. It should possible to adapt your existing VBA code to run under ASP.NET with some changes, but you will have a much more reliable product in the end.
Example Code
However, as #whardier points out in his response, if this were for a large scale or public site, the suggestions he makes would be much more suitable and would scale much further.

Resources