Export to pdf SSRS - reporting-services

I've some questions regarding SSRS:
I want to create Account Statements of each client
Is it possible in SSRS to do so that I will pass AccountID as a parameter for each client, and it will form and save pdf files in C drive for each AccountID. How can I automate that?
I've e-mail table of each client. Is it possible to send account statements to clients according to this e-mail list? In other words, can I query recipients of account statements and send them an e-mail with their account statements.
Thanks

If you want to do this on a regular basis, you need to utilize a feature called Data Driven Subscription.
Basically, it looks at a table(Parameter, EmailAddress) in a SQL Server.
For instance, let's say you have:
ID - Name ------ Parameter ---------------- Email
1 - SalesGuy1 - 123123123 - SalesGuy1#emailaddress.com
2 - SalesGuy2 - 111111111 - SalesGuy2#emailaddress.com
3 - SalesGuy3 - 222222222 - SalesGuy3#emailaddress.com
It then, according to this table, executes with a parameter and sends report to appropriate user.
There is no short way of describing step-by-step, so please have a look at a well-written Microsoft KB article: https://technet.microsoft.com/en-us/library/aa237461%28v=sql.80%29.aspx
There is also slightly newer version (but basically the same content):
https://msdn.microsoft.com/en-us/library/ms169673.aspx
Note: You cannot use Shared Data source with data driven subscription. You have to configure email settings inside SSRS for this to work.

Related

Query Google Admin User directory comparing parameters

I'm trying to filter my users list by comparing two parameters
query="EmployeeData.EmployeeID=externalId"
EmployeeData.EmployeeID is a custom schema that is populated, with a cron job, with the same value as externalId.
Of course I let the cron do the field copy only if necessary, this is the reason I'm trying to filtering the users list.
In the way i wrote seems that the query trying to looking for a value "externalId" into the EmployeeData.EmployeeID ignoring that "externalId" is a even a field
any suggestion?
The way your code is written, the query sent to Google's servers is as you correctly guessed the following:
EmployeeData.EmployeeID=externalId where your actual externalId is not sent but rather the string "externalId".
To replace this string for the actual value of your variable, you can use what is called "string concatenation" 1. To do it, you just need to modify your code as shown below:
query="EmployeeData.EmployeeID=" + externalId;
This way, the query will be sent as you need to Google's servers.

Monthly or weekly report of PayPal Completed Payments automatically

We can download a CSV or XLS of PayPal Completed Payments by manually going to https://business.paypal.com/merchantdata/reportHome and doing "Activity download":
But how to get this CSV report, automatically (via email or with an API), each week or each month, without having to manually log in on the website?
Note:
I've already looked at PayFlow reports and download-reports but it seems quite complex, and there is no full example (only XML samples but it's unclear how to use them)
I don't want to use IPN for this (I do use it for another task, but it's not perfectly reliable for other reasons, etc.)
Example of desired output:
"Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Shipping Address","Address Status","Item Title","Item ID","Shipping and Handling Amount","Insurance Amount","Sales Tax","Option 1 Name","Option 1 Value","Option 2 Name","Option 2 Value","Reference Txn ID","Invoice Number","Custom Number","Quantity","Receipt ID","Balance","Address Line 1","Address Line 2/District/Neighborhood","Town/City","State/Province/Region/County/Territory/Prefecture/Republic","Zip/Postal Code","Country","Contact Phone Number","Subject","Note","Country Code","Balance Impact"
"3/1/2018","04:52:07","CET","John Doe","Website Payment","Completed","EUR","100.00","0","100","johndoe#gmail.com","contact#example.com",...
"3/1/2018","16:29:30","CET","Mike Abcd","Website Payment","Completed","EUR","100.00","0","100","mikeabc#example.com","contact#example.com",...
You will have to do it through the XML api. Basically, you make a post request with the example XML in the link you gave but with your data. The response will be in XML and you take the returned reportId and then call the get report api and it will return in xml the report data.

I want to execute a report subscription by clicking on a field

I have created a report on the SQL Server Report Service that lists all reports and their corresponding subscriptions.
[report name] [subscription description] [run]
I have added a column called [run] that contains an image. I want to make it so that if the user clicks on the [run] image/cell, it executes the corresponding subscription.
Is this possible?
I've looked at the image action, but it only seems to allow execution of reports (not subscriptions) or URLs.
The workaround I used was to create a separate report called SubscriptionRunner which accepts one parameter (the subscription id) and executes that subscription using the following SQL (provided by Anthony Forloney):
EXEC ReportServer.dbo.AddEvent #EventType='TimedSubscription', #EventData=<SubscriptionID>
I then set the Action property of the cell in the original report to Run the SubscriptionRunner report.
This has the side effect of opening SubscriptionRunner (which I would prefer to avoid) but it will do for now.

How to specify the report pdf name at run time?

I have a report named "Debt Report ". It runs for every month and a pdf is generated at the first of the month by subscription option.
If I am running the report for the month then the report name of the pdf should be "Debt Report for April" and like wise if I run it for may then the name of the pdf should be "Debt Report for May".
How can I do this?
Assuming you are scheduling the report to a file share, you can set the name of the file share to be Debt Report for #timestamp - this will name the file in the format Debt Report for YYYY_MM_DD_HRMINSS .
If you only want the month name (not the entire timestamp) to appear in the filename, you will need to use a Data Driven Subscription.
Another option, although a bit more technical, is to use the rs.exe utility to generate the report. This involves:
creating a script file that generates the report (this is where you can set the filename to your preference)
creating a batch file that calls rs.exe with the script file as a parameter
running the batch file on a schedule e.g. with Windows scheduler or SQL Server Agent
There is an example here of how to do this (to create Excel files but the principle is the same) http://skamie.wordpress.com/2010/08/11/using-rs-exe-to-render-ssrs-reports/
The solution for this problem is "Data Driven Subscription"
http://msdn.microsoft.com/en-us/library/ms169972(v=sql.105).aspx
http://www.kodyaz.com/reporting-services/create-data-driven-subscription-in-sql-server.aspx
the following link helped me alot but the query given in the link creates trouble- cast the datatype of the getdate and it will solve the problem
http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/0f075d9b-52f5-4a92-8570-43bbdaf2b2b1
I have had to do the same thing ( well almost )
I had to generate a weekly report to file and save it as REPORT-Week01.pdf, then REPORT-Week02.pdf etc.
The mechanism I used was to change the parameter column in the Schedule table via a scheduled job. This computed the required file name and simply replaced it. Then when the scheduled job runs, it writes to the file name setup when the schedule was created ( except that was changed at 1 minute past midnight to what I wanted it to be )
I have since implemeted another set of reports that write to a folder, whihc changes each month the the next months folder name ( currently writing all reports to a folder called 202103 ) tonight the job will run and the output folder will change to 202104 and the scheduled jobs will never need changing

Send email to dynamic recipient SSIS Send Mail Task

I have an SSIS package which is going to be deployed on test, staging, and finally production.
It has a couple of "Send Mail Tasks",say 10.
As developer, I put my email address as the recipient of the email.
Currently, for the test person, I need to change all the "To"s in all the script task to e.g. "TestPerson#test.com". If following the paradigm of hard-coding the emails this way,I need to change the recipient email 30 times!!! (10 for each stage stated above)
Just wondering if there is any way to inject To field(recipient) dynamically. e.g. from a variable. like I have done for the "MessageSource"
You can set the ToLine of the Send Mail task to be the value of a variable, using an Expression from the Properties window of the task.
We use a SQL table containing a list of email recipients for various conditions (table columns of kemail, emailaddress, success, error) and set flags in the table to 0=no, 1=yes for that particular user to receive emails on particular conditions.
Then create a variable that contains a delimited list of your recipients then use an expression to set "ToLine" for the send mail task.
The only thing to watch here is that you don't end up with a no records returned from the SQL table. We always have our "support" email address always having all the bits set, to avoid this.
So the package wont need to be modified when a new user needs to receive email updates.