Sunday, March 25, 2012
Computed parameters for subscribed & scheduled report?
I've done some experimenting with the SQL Server Reporting Services and
like them very much.
However, I now have a problem I wasn't able to find a solution for: I need
to create a monthly report about my company's sales. I've set up my
subscription so that the report is mailed (as pdf) on every Monday in the
new month's first week.
Of course, I want to have the *LAST* month reported, not the current one,
so I'd need to compute the start- and end date of the report (which are
parameters). How can I do that?
Thanks!
JensCheck out the DateAdd function at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vaorivbruntimelibrarykeywords.asp
roland|||I had exactly the same need (actually who doesn't! this should be easier ..)
and finally decided to write and external assembly that defines the ToDate
and FromDate based on relative periods stored in the DB (PeriodID passed )
The PeriodID allows me to find the calculation rule for taking today as a
starting point and start calculating relative Periods (range or single dates
( last month, last 3 month, first quarter, etc, etc.))
Sebastian|||In news:OtzAWWzYEHA.3564@.TK2MSFTNGP11.phx.gbl,
Sebastian Talamoni <sebastian.talamoni@.radventure.nl> typed:
> I had exactly the same need (actually who doesn't! this
> should be easier ..) and finally decided to write and
> external assembly that defines the ToDate and FromDate
> based on relative periods stored in the DB (PeriodID
> passed )
> The PeriodID allows me to find the calculation rule for
> taking today as a starting point and start calculating
> relative Periods (range or single dates ( last month,
> last 3 month, first quarter, etc, etc.))
> Sebastian
What I meant was: Don't provide any parameters on call. Schedule your
reports to run on every first of a month. Define defaults for the parameters
which calculate e.g. the first of the last month that way:
= new System.DateTime(Year(DateAdd(DateInterval.Month, -1,
Globals!ExecutionTime)), Month(DateAdd(DateInterval.Month, -1,
Globals!ExecutionTime)),1)
Other values in comparible manner, left to your phantasy :)
roland
Computed Fields/Multiple Datasources
I am having trouble with computed fields. I have two issues:
1. I have a special dataset that I use to read parameters from a
database table. This table has only one row. I would like to add a
computed field that divides one of the columns in this row by another.
I created a computed field called ProRatedMultiplier with the following
definition:
=Fields!OPERATINGDAYSINMONTH.Value/Fields!INVOICINGDAY.Value
The problem is that when I insert this computed field into my report,
it wants to sum the output:
=Sum(Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS")
If I remove the SUM() function, I get compile errors.
I need to use this computed value in many places on the report and thus
would like to have the formula defined only once (instead of repeating
it in each field).
It seems SRS sees it as returning one or more rows and thus wants to
aggregate. Am I going about this the wrong way? Can I make any changes
to make this work?
2. Assuming I get the above to work, I will have this new computed
field on my dataset. I would like to create a computed field on another
dataset that uses this first computed field value.
This new, second computed field would multiply the first computed field
value (which is a pro-rata multiplier) by the sum() aggregate of a
column in the second dataset.
The definition would like something like this:
=SUM( Fields!INVOICEAMOUNT.Value) *
Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS"
This also will not compile.
Am I going about this the wrong way?For #1:
Use the First aggregate function:
=First(Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS")
So even if your InputDataDS dataset has more than one rows (for whatever
reasons), you will still get the expected result. Since you use the
calculated field value in another dataset, you cannot omit the aggregate
function (otherwise the fields collection would be scoped to the wrong
dataset).
For #2:
You could write an expression in a textbox like this:
=SUM( Fields!INVOICEAMOUNT.Value) * First(
Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS")
However, you cannot define a calculated field which uses aggregate
functions.
Probably a better solution for #1 & #2:
Since you have only 1 row - did you look into hidden textboxes, which
calculate the formulas instead of calculated fields? You could then
reference the value of the formula textbox in other textboxes by using an
expression like
=ReportItems!FormulaTextbox.Value
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Hunter Hillegas" <hunter.hillegas@.gmail.com> wrote in message
news:chqjea$pq0@.odak26.prod.google.com...
> I am getting started with Reporting Services.
> I am having trouble with computed fields. I have two issues:
> 1. I have a special dataset that I use to read parameters from a
> database table. This table has only one row. I would like to add a
> computed field that divides one of the columns in this row by another.
> I created a computed field called ProRatedMultiplier with the following
> definition:
> =Fields!OPERATINGDAYSINMONTH.Value/Fields!INVOICINGDAY.Value
> The problem is that when I insert this computed field into my report,
> it wants to sum the output:
> =Sum(Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS")
> If I remove the SUM() function, I get compile errors.
> I need to use this computed value in many places on the report and thus
> would like to have the formula defined only once (instead of repeating
> it in each field).
> It seems SRS sees it as returning one or more rows and thus wants to
> aggregate. Am I going about this the wrong way? Can I make any changes
> to make this work?
> 2. Assuming I get the above to work, I will have this new computed
> field on my dataset. I would like to create a computed field on another
> dataset that uses this first computed field value.
> This new, second computed field would multiply the first computed field
> value (which is a pro-rata multiplier) by the sum() aggregate of a
> column in the second dataset.
> The definition would like something like this:
> =SUM( Fields!INVOICEAMOUNT.Value) *
> Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS"
> This also will not compile.
> Am I going about this the wrong way?
>
Tuesday, March 20, 2012
Compress/Zip Reporting Services Export options
Hey everyone,
I have an issue where i am sending out files with 30,000+ lines and they are reaching the 11mb, 12mb in size.
This is becoming and issue for us, as we are only allowed to email up to 10mb in size.
I have tried reducing all spaces in the data, removing any graphics etc from the report , but still the excel file is over 11mb. One thing i did find was that, if i export it to excel, then open the file and save as a different file name the file size drops 50% !!
I was wondering if anyone has been able to zip/compress the exported file before it gets emailed?
It would be a great feature for MS to include in the next service pack.. Take advantage of the built in Zip support in Windows..
Look forward to hearing any suggestions that the community may have,
Thanks
Scotty
Hi there-Unfortunately you'll have to create a custom delivery extension for your report server. You can look at the PrinterDeleiveryExample in the RS samples folder (located wherever you installed RS) to give you an idea of what you'll need to do.
If you are using .Net 2.0, then you can use the System.IO.Compression and System.Net.Mail libraries as part of your delivery extension. I unfortunately have a client that hasn't migrated to .Net 2.0 and I had to use .Net 1.1. I used two open source libraries to accomplish the task: DotNetOpenMail and SharpZipLib. I decided to use DotNetOpenMail, because you can create an attachment from an array of bytes, which you can't do with the System.Web.Mail library in .Net 1.1. So for my custom delivery extension, I zipped my report to a memory stream and then attached that stream's byte array to the e-mail.
Here are some links to get you started:
DotNetOpenMail - http://dotnetopenmail.sourceforge.net
SharpZipLib - http://www.icsharpcode.net/OpenSource/SharpZipLib
Hope that gives you a starting point to a solution. If you have any questions, please respond back here.
Regards,
Scott
Thursday, March 8, 2012
Complex sum
The report contains a field 'FIELD A' which displays the difference of hours in that record.
At the end of the report, I need to sum all FIELD A and display in FIELD B.
How do I do it?One way to do this, if all the 'FIELD A' textboxes exist on one page, is to add the 'Field B' textbox to the Page Footer, and use the SUM aggregate over the textbox. For example,
=(Sum(ReportItems!FieldATextbox.Value))
This will only work if the expression is in the Page Header or Footer, and if all instances of the 'Field A' textbox is on the same page.
If not all instances will exist on one page, then you could use a simple custom function that is called from the 'Field A' textbox. This custom function adds the value passed to a member field, and then returns the value passed. In the 'Field B' textbox call a separate custom function that returns the value stored in the member field.
Ian
Wednesday, March 7, 2012
Complex Quieries - Reporting Services
Greetings:
I have the following query which will get the column name of the table I am trying to work on ..
· SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS Where TABLE_NAME = 'MyDataTable'
This query will give me the column name of “MyDataTable”. But I need to add some calculated field – i.e get the number of rows which are not null from “myDataTable” for a particular column.
I tried :
SELECT COLUMN_NAME,
myField = (Select Count(*) from myDataTable);
FROM INFORMATION_SCHEMA.COLUMNS Where TABLE_NAME = 'MyDataTable'
The above one gives me the total number of rows in the “myDataTable”
myField should be base on the name of the column, so it should be something like
myField = (Select Count(COLUMN_NAME) from myDataTable);
But When I do that the COLUMN_NAME is not recognized during run-time.
Anybody that have some kind of idea for a work around please help.
Thanks,
Yared,
Dynamic query can be used.
http://msdn2.microsoft.com/en-us/library/ms157131.aspx
Sunday, February 19, 2012
Complete Newbie Question
I want to run in a web page - that seems easy enough to do but my boss
has asked me to provide a batch reporting solution.
He wants users to be able to request a report and the request be
written away to a sql db. I have a windows service that picks up all
new requests and fires up some .exe's depending on what sort of request
it is e.g password reset , password reminder etc..
When the reports are run I need them to be saved as PDF's into a
specific folder that can be accessed later from a web page.
Now all this is written and working using ActiveReports for .NET but we
hate that package and want to use sql reporting services. Can it be
done in sql reporting services and if so how do I do it - I mean I need
some real code examples
any help would be brilliant
cheers
JimI have been using log4net to log to SQL DB. You can log the web request when
reports are rendered. It is upto you to write the logic to who views the
page( for eg using session object who the user was like,
Session["UserName"]). log4net allows you to log when certain events are
triggered blah blah... Check out:
http://logging.apache.org/log4net/release/config-examples.html
Look for ADONETAppender which is what you want.
HTH
Rajesh Meenrajan
MCSD.NET
http://meenrajan.blogspot.com
"JimW13UK" wrote:
> I have just installed Reporting Services and created a few reports that
> I want to run in a web page - that seems easy enough to do but my boss
> has asked me to provide a batch reporting solution.
> He wants users to be able to request a report and the request be
> written away to a sql db. I have a windows service that picks up all
> new requests and fires up some .exe's depending on what sort of request
> it is e.g password reset , password reminder etc..
> When the reports are run I need them to be saved as PDF's into a
> specific folder that can be accessed later from a web page.
> Now all this is written and working using ActiveReports for .NET but we
> hate that package and want to use sql reporting services. Can it be
> done in sql reporting services and if so how do I do it - I mean I need
> some real code examples
> any help would be brilliant
> cheers
> Jim
>
Friday, February 17, 2012
compilation error while adding web reference RS05
if i try to add a web reference in my c# application to reporting services
2005 i got a compilation error.
a part of the displayed message:
--
source error:
line 4: <%@. Import Namespace="System.Xml" %> <-- is a red line
error message:
CS0234: The type or namespace name 'Xml' does not exist in the namspace
'System' (are you missing an assembly reference?
do anybody know a solution for this problem?
thx
MartinTake a look at this forum:
http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=10847
particularly the post from AkhilaL MSFT
Jens Konerow
Sunday, February 12, 2012
compatibility issue between Reporting Services and IE7 !!!
Is there any compatibility issue between Reporting Services and IE7. We need to test compatibility with both SQL Server 2005/200 versions.
I have been using RS 2005 and IE 7 since IE 7 was released and have had no issues so far.|||The 2005 version of Reporting Services should work with no issues. The 2000 Version of Reporting Services has not been certified to work on IE7. There are known issues that make RS2000 less usable. One issue that I know of is that Document Maps do not work.|||We are having an Issue:
In IE 6 the Report runs correctly but in IE 7 it does not display the complete Report. It cuts off the bottom.
What direction should we look?
|||What version of Reporting Services are you using. RS2000 or 2005?
Please send me a simple repro and I can take a look to see what the issue is. bradsy@.removemicrosoft.com
|||It is SQL Reporting Service 2005.
Will send you more info via E-Mail.
|||We have Reporting services in SQL server 2000 . IE7 cannot download the exported files ( all pdf, excel ...). It prompts an error message when export button is clicked.It works perfectly in IE6.
Anyone has any solution.
|||I too am running into the issue of exporting reports and cannot find a solutions. Has anyone found a work around or has MS released a patch that anyone knows about?
Thanks,
Ben|||
Mr. Sullins,
I, too, am having the same problem. It appears to be something in the rdl, what it is I haven't pinned down. Interestingly, I can get the report to render without being cutoff by deleting this line in my master page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Thanks for your help,
Brian Morgan
compatibility issue between Reporting Services and IE7 !!!
Is there any compatibility issue between Reporting Services and IE7. We need to test compatibility with both SQL Server 2005/200 versions.
I have been using RS 2005 and IE 7 since IE 7 was released and have had no issues so far.|||The 2005 version of Reporting Services should work with no issues. The 2000 Version of Reporting Services has not been certified to work on IE7. There are known issues that make RS2000 less usable. One issue that I know of is that Document Maps do not work.|||We are having an Issue:
In IE 6 the Report runs correctly but in IE 7 it does not display the complete Report. It cuts off the bottom.
What direction should we look?
|||What version of Reporting Services are you using. RS2000 or 2005?
Please send me a simple repro and I can take a look to see what the issue is. bradsy@.removemicrosoft.com
|||It is SQL Reporting Service 2005.
Will send you more info via E-Mail.
|||We have Reporting services in SQL server 2000 . IE7 cannot download the exported files ( all pdf, excel ...). It prompts an error message when export button is clicked.It works perfectly in IE6.
Anyone has any solution.|||I too am running into the issue of exporting reports and cannot find a solutions. Has anyone found a work around or has MS released a patch that anyone knows about?
Thanks,
Ben|||
Mr. Sullins,
I, too, am having the same problem. It appears to be something in the rdl, what it is I haven't pinned down. Interestingly, I can get the report to render without being cutoff by deleting this line in my master page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Thanks for your help,
Brian Morgan
compatibility issue between Reporting Services and IE7 !!!
Is there any compatibility issue between Reporting Services and IE7. We need to test compatibility with both SQL Server 2005/200 versions.
I have been using RS 2005 and IE 7 since IE 7 was released and have had no issues so far.|||The 2005 version of Reporting Services should work with no issues. The 2000 Version of Reporting Services has not been certified to work on IE7. There are known issues that make RS2000 less usable. One issue that I know of is that Document Maps do not work.|||We are having an Issue:
In IE 6 the Report runs correctly but in IE 7 it does not display the complete Report. It cuts off the bottom.
What direction should we look?
|||What version of Reporting Services are you using. RS2000 or 2005?
Please send me a simple repro and I can take a look to see what the issue is. bradsy@.removemicrosoft.com
|||It is SQL Reporting Service 2005.
Will send you more info via E-Mail.
|||We have Reporting services in SQL server 2000 . IE7 cannot download the exported files ( all pdf, excel ...). It prompts an error message when export button is clicked.It works perfectly in IE6.
Anyone has any solution.
|||I too am running into the issue of exporting reports and cannot find a solutions. Has anyone found a work around or has MS released a patch that anyone knows about?
Thanks,
Ben|||
Mr. Sullins,
I, too, am having the same problem. It appears to be something in the rdl, what it is I haven't pinned down. Interestingly, I can get the report to render without being cutoff by deleting this line in my master page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Thanks for your help,
Brian Morgan
compatibility issue between Reporting Services and IE7 !!!
Is there any compatibility issue between Reporting Services and IE7. We need to test compatibility with both SQL Server 2005/200 versions.
I have been using RS 2005 and IE 7 since IE 7 was released and have had no issues so far.|||The 2005 version of Reporting Services should work with no issues. The 2000 Version of Reporting Services has not been certified to work on IE7. There are known issues that make RS2000 less usable. One issue that I know of is that Document Maps do not work.|||We are having an Issue:
In IE 6 the Report runs correctly but in IE 7 it does not display the complete Report. It cuts off the bottom.
What direction should we look?
|||What version of Reporting Services are you using. RS2000 or 2005?
Please send me a simple repro and I can take a look to see what the issue is. bradsy@.removemicrosoft.com
|||It is SQL Reporting Service 2005.
Will send you more info via E-Mail.
|||We have Reporting services in SQL server 2000 . IE7 cannot download the exported files ( all pdf, excel ...). It prompts an error message when export button is clicked.It works perfectly in IE6.
Anyone has any solution.|||I too am running into the issue of exporting reports and cannot find a solutions. Has anyone found a work around or has MS released a patch that anyone knows about?
Thanks,
Ben|||
Mr. Sullins,
I, too, am having the same problem. It appears to be something in the rdl, what it is I haven't pinned down. Interestingly, I can get the report to render without being cutoff by deleting this line in my master page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Thanks for your help,
Brian Morgan
Comparison with Crystal Reports
it. He asked me if we could completely move away from Crystal Reports (CR) to
SRSS.
Does anyone have any issues with SRSS that didnt exist in CR.
One question i have is programmability capabilities. Some time back i had to
make a very complex report in CR. I create a table in the dataset. Designed
the report to pull data from that table and the table was being populated
through some VB.NET code. So the users will open a GUI and hit RUN, which is
when i will populate the table and show the report. You can assume that
populating the table required complex programming and couldnt have been done
through user defined functions in a report.
I dont suppose stuff like this can be done in SRSS?RS is designed a lot more around creating the query or the stored procedure
as the source for the report. You can have multiple datasets in a report and
you can easily create 1-many reports using subreports. If you absolutely
must create the dataset via code you can do this either using the VS 2005
report control in local mode (no server, you had the control the report and
the dataset) or you can create a data process extension. Neither is
non-trivial. I have done very complex reports and have never flelt the need
for creating the dataset in code. All my reports either have the query or a
stored procedure with it.
The reports have parameters that the user selects (can be either from a list
(which can be filled by a query) or date control etc). The parameters can be
cascading. i.e the second parameter list depends on what is picked with the
first parameter. Also you can have multi-select parameters as well.
The only issue I have seen are people that have a set of business objects
coded or they want to code that way. You can do this but it is harder (data
processing extension).
HTH,
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Tk_Neo" <TkNeo@.discussions.microsoft.com> wrote in message
news:9DB999DE-15AF-4E6F-BAB9-AF0D71FAC886@.microsoft.com...
>I showed my boss the functionality of ad hoc reporting in SRSS and he likes
> it. He asked me if we could completely move away from Crystal Reports (CR)
> to
> SRSS.
> Does anyone have any issues with SRSS that didnt exist in CR.
> One question i have is programmability capabilities. Some time back i had
> to
> make a very complex report in CR. I create a table in the dataset.
> Designed
> the report to pull data from that table and the table was being populated
> through some VB.NET code. So the users will open a GUI and hit RUN, which
> is
> when i will populate the table and show the report. You can assume that
> populating the table required complex programming and couldnt have been
> done
> through user defined functions in a report.
> I dont suppose stuff like this can be done in SRSS?
Comparison with Crystal Reports
Does anyone have any issues with SRSS that didnt exist in CR.
One question i have is programmability capabilities. Some time back i had to make a very complex report in CR. I create a table in the dataset. Designed the report to pull data from that table and the table was being populated through some VB.NET code. So the users will open a GUI and hit RUN, which is when i will populate the table and show the report. You can assume that populating the table required complex programming and couldnt have been done through user defined functions in a report.
I dont suppose stuff like this can be done in SRSS?
Depending on the version of Crystal you have, there are various differences, though it is a good path to move to in my opinion.
Here is one summary I have found outlining differences:
http://www.crystalreportsbook.com/SSRSandCR_ExecSummary.asp
There's lots of information out there on this.
It is also possible to use a dataset as the source of report data in a custom application with Reporting Services.
cheers,
Andrew