Showing posts with label solution. Show all posts
Showing posts with label solution. Show all posts

Monday, March 26, 2012

Generic way to style reports (CSS Style)

I want to make a CSS Style solution for my reports. I have few ideas related to this, changing the report properties on the fly, but I am not sure for which I should go for.

- We know that we can put expression on reports almost everywhere, and can also call custom code for setting up those expressions. i.e.

Public Shared Function GetValue(ByVal Key As String) As String

Dim myDataReader As SqlDataReader
Dim mySqlConnection As SqlConnection
Dim mySqlCommand As SqlCommand

mySqlConnection = New SqlConnection("server=localhost;Trusted_Connection=yes;database=tempMIQB")
mySqlCommand = New SqlCommand("SELECT * FROM [Properties] Where PropertyName='" & Key & "'", mySqlConnection)
mySqlConnection.Open()
myDataReader = mySqlCommand.ExecuteReader(CommandBehavior.CloseConnection)

If myDataReader.Read() Then
GetValue = myDataReader.Item("PropertyValue").ToString
Else
GetValue = "None"
End If

End Function

and in textbox or any where I can say =Code.GetValue("BGColor") or from .NET dll.

For going further on with this idea I can create an .NET dll and get the list from database or XML file. (Please give suggestions for performance/scalability issue.)

- second idea is to write a custom application (script) which can go through all the reports and change the color and fonts and every thing.

- third is to use parameters and use Array.IndexOf method to search for the value, but in this case i need to add dataset to all reports and, I think we cannot access report properties i.e. Parameters from custom code, just to make a generic function to access parameter value.

Hi Noordin,

I'm also trying to do this. Could you give me some leads as to how you accomplished it in the end?

Thanks,
Phil

Generic way to style reports (CSS Style)

I want to make a CSS Style solution for my reports. I have few ideas related to this, changing the report properties on the fly, but I am not sure for which I should go for.

- We know that we can put expression on reports almost everywhere, and can also call custom code for setting up those expressions. i.e.

PublicSharedFunction GetValue(ByVal Key AsString) AsString

Dim myDataReader As SqlDataReader
Dim mySqlConnection As SqlConnection
Dim mySqlCommand As SqlCommand

mySqlConnection = New SqlConnection("server=localhost;Trusted_Connection=yes;database=tempMIQB")
mySqlCommand = New SqlCommand("SELECT * FROM [Properties] Where PropertyName='" & Key & "'", mySqlConnection)
mySqlConnection.Open()
myDataReader = mySqlCommand.ExecuteReader(CommandBehavior.CloseConnection)

If myDataReader.Read() Then
GetValue = myDataReader.Item("PropertyValue").ToString
Else
GetValue = "None"
EndIf

EndFunction

and in textbox or any where I can say =Code.GetValue("BGColor") or from .NET dll.

For going further on with this idea I can create an .NET dll and get the list from database or XML file. (Please give suggestions for performance/scalability issue.)

- second idea is to write a custom application (script) which can go through all the reports and change the color and fonts and every thing.

- third is to use parameters and use Array.IndexOf method to search for the value, but in this case i need to add dataset to all reports and, I think we cannot access report properties i.e. Parameters from custom code, just to make a generic function to access parameter value.

Hi Noordin,

I'm also trying to do this. Could you give me some leads as to how you accomplished it in the end?

Thanks,
Phil

Wednesday, March 21, 2012

Generating reports using data feeds from other systems

Dear all,
I've been following this group with interest for a while now but haven't
seen any firm pointers for a solution to meet my problems.
Essentially I would like to be able to
1) Create reports, acknowledgements, delivery notes, invoices, etc using
data supplied from my legacy system Unix.
2) Output them to PDF - some of the parameters of this would be in the data
feed.
3) Email or fax these PDFs to our customers.
It's not possible Reporting Services to query directly our system due to
other limitations, but can we feed RS with data either via uploading a file
to a "watch" directory or via a print spool queue on the windows system - we
already use both methods for other applications.
The reason for a print queue is it's easy to implement from Unix to
Windows - no messing with FTP etc, and print queues already exist in our
application.
The format of the data feed can be XML or indeed anything as we are source
code holders for our product.
The questions are:
1) Is this vaguely possible. ?
2) Can RS take it's feed from a print queue - with possibly us putting
together the software to accept the data on the print queue.
3) Could it handle files dropped into a "watch directory"
4) Can RS create PDFs using parameters in the feed file.
5) Could RS, with perhaps additional development, distribute the PDFs based
on parameters contained with the data feed.
If anyone could shed any light on my thoughts, or perhaps, they've done
something like this already, I would greatly appreciate some feedback.
How about this as a product Microsoft - all those legacy systems out there
suddenly able to print something a little better than the old dot-matrix
print-outs on pre-printed stationary. !!!
Any pointers would be much appreciated.
Kind Rgds
Graham GoodeyThis is possible but you will need to write a custom data extension for both
the data in the report as well as driving the delivery of reports. I think
the file-based approach will be easier than the print queue.
--
Brian Welcker
Group Program Manager
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Graham Goodey" <graham_goodey@.yahoo.com> wrote in message
news:O4b500PVEHA.1012@.TK2MSFTNGP09.phx.gbl...
> Dear all,
> I've been following this group with interest for a while now but haven't
> seen any firm pointers for a solution to meet my problems.
> Essentially I would like to be able to
> 1) Create reports, acknowledgements, delivery notes, invoices, etc using
> data supplied from my legacy system Unix.
> 2) Output them to PDF - some of the parameters of this would be in the
data
> feed.
> 3) Email or fax these PDFs to our customers.
> It's not possible Reporting Services to query directly our system due to
> other limitations, but can we feed RS with data either via uploading a
file
> to a "watch" directory or via a print spool queue on the windows system -
we
> already use both methods for other applications.
> The reason for a print queue is it's easy to implement from Unix to
> Windows - no messing with FTP etc, and print queues already exist in our
> application.
> The format of the data feed can be XML or indeed anything as we are source
> code holders for our product.
> The questions are:
> 1) Is this vaguely possible. ?
> 2) Can RS take it's feed from a print queue - with possibly us putting
> together the software to accept the data on the print queue.
> 3) Could it handle files dropped into a "watch directory"
> 4) Can RS create PDFs using parameters in the feed file.
> 5) Could RS, with perhaps additional development, distribute the PDFs
based
> on parameters contained with the data feed.
> If anyone could shed any light on my thoughts, or perhaps, they've done
> something like this already, I would greatly appreciate some feedback.
>
> How about this as a product Microsoft - all those legacy systems out there
> suddenly able to print something a little better than the old dot-matrix
> print-outs on pre-printed stationary. !!!
>
> Any pointers would be much appreciated.
>
> Kind Rgds
>
> Graham Goodey
>
>
>

Monday, March 12, 2012

Generated Report Model

I'm working on a software project that requires a reporting solution.
Of all the solutions we have looked at RS2005 seems to fit best with
our product, however, I had a few queries.
1. Our data is stored in a non-relation format but for reporting the
end user can select what data the wish to report on and a relational
table model is created. Because the table structure is not known until
this point, is it possible to create a Report Data Model in code so
that we can use the end user report designer.
2. Because of the JIT generation of the relational tables, the table
names are not known until the report is requested, is it possible to
pass the table names into the report as parameters? Is it possible to
use these parameters in th Report Data Model?
3. Is it possible to get column totals and group sub-totals in reports
designed in the Report Builder end user designer?
4. Is it (going to be) possible to design free flow reports in the
Report Builder rather than just table, matrix or chart reports?
Many thanks,
Adrian RitchieHi Adrian,
not knowing anything at all about your project...have you considered
using a separate data warehouse for the reporting solution and
propagating changes from the operational system to the BI System so
that you have access to a relational database for reporting...also,
your reporting and analysis needs are very likely to grow past simple
reporting, and I would think you are building in rather sever
limitations trying to write a JIT style application to generate tables
for reporting....I do not see how it could possibly scale as you must
JIT push data into tables when a report is requested rather than just
reading a table that is already there...'
Peter
www.peternolan.com|||Hi Peter,
I realise that my explaination of our system is rather vague but that
was as much as I could really write without breaching my NDA :(
Having a separate data warehouse sounds like a good idea and I will run
it past some of the other guys here but I fear may not be practical.
The reason the relational model is not generated until reports are
requested is that:
1. The data storage structure is flexible. We ship out a standard
structure but clients can modify and add to it as they see fit (with
appropriate security rights).
2. The data in the system is temporal. The end user can request a
report for any point in time for which there is data in the system.
The point in time that the user selects will determine what database
structure they get (as the structure may change over time).
The second problem may not be a problem at all, it's just that I
haven't thought of another solution for it, so any suggestions will be
greatfully received.
Adrian Ritchie|||Hi Adrian,
I understand the world of NDAs...no problems...
1. Changes to source data structures for applications rolled out is
always a problem but not a hard one to solve...
2. All data structures are 'temporal' it's just that most people don't
know it and think they don't change. They do and the analysis system
must take care of that...
I've done systems easily handling both 1 and 2......so I still think
that unless you have some really good reasons for building the
limitations into your reporting system that you very likely will do
taking a look at something separate would be a good idea...Like I said,
I know nothing about what you are doing...so these are just my
thoughts...
Peter
www.peternolan.com

Generate XML document problem

I'm having the same problem as described below. Although this was
posted on usenet a few years ago, a solution was not posted, and I
can't find one on the internet anywhere. Does anyone have any idea as
to how I might workaround this? Note that I am not sorting on any of
the varchar fields that are causing the problem.
Thanks,
Aaron

> Here is the problem,
> I need to generate an XML document using FOR XML Explicit. My select
> works fine but I run into a problem when I try to do an order by with
> a row that is greater than 8094 bytes. SQL Server outputs the error
> "Cannot sort a row of size 96555, which is greater than the allowable
> maximum of 8094".
> The order by is very important in my query, because without it. I will
> not get the XML document in the correct schema.
> I have researched this issue and have come to the conclusion there is
> not a way I know of to get around this limitation. I tried using the
> query hint "Robust Plan" and "Force Order" and that did not work.
> A solution that I thought of, but don't know if it will work and how
> to do in SQL server is to first generate the XML schema without the
> TEXT column fields and then do another query to load the text columns
> into the XML document.
> Can I and how do I do all of this in a Stored Procedure?
> Or is there a better workaround for my problem?
> Thanks in advance
>
> --
> B. HarilalHi Aaron
Can you please provide some more information? Is it the order by clause that
may contain too much data? Or the rows that you sort?
It would be very useful if you can provide a simple repro.
Thanks
Michael
"AaronS" <gcsdba1@.yahoo.com> wrote in message
news:1140618933.285133.96480@.z14g2000cwz.googlegroups.com...
> I'm having the same problem as described below. Although this was
> posted on usenet a few years ago, a solution was not posted, and I
> can't find one on the internet anywhere. Does anyone have any idea as
> to how I might workaround this? Note that I am not sorting on any of
> the varchar fields that are causing the problem.
> Thanks,
> Aaron
>
>|||Here's an example of what the query is trying to do. I know this query
is not logically correct, but hopefully it gives you an idea of what
the actual query is doing.
SELECT
1 as Tag,
NULL as Parent,
reportID as [reportData!1!id],
NULL as [comments!5!reportCommentID!hide],
NULL as [comment!15!details],
NULL as [Notes!10!reportCaseID!hide],
NULL as [Note!30!noteDesc]
FROM report
UNION ALL
SELECT
15 as Tag,
5 as Parent,
NULL as [reportData!1!id],
reportID as [comments!5!reportCommentID!hide],
details as [comment!15!details] -- varchar(8000)
NULL as [Notes!10!reportCaseID!hide],
NULL as [Note!30!noteDesc]
FROM comment
UNION ALL
SELECT
30 as Tag,
10 as Parent,
NULL as [reportData!1!id],
NULL as [comments!5!reportCommentID!hide],
NULL as [comment!15!details],
reportID as [Notes!10!reportCaseID!hide],
NoteDesc as [Note!30!noteDesc] -- varchar(8000)
FROM note
-- Note that the sort is not on any of the "long" varchar fields
ORDER BY
[reportData!1!id],
[comments!5!reportCommentID!hide]
[Notes!10!reportCaseID!hide]|||Hi Michael,
I realize my SQL example is very crude (especially since I left out any
join conditions), but does it get the idea across about where the
problem lies? It appears to be the rows I am attempting sort that
contain too much data for SQL Server to handle. The columns specified
in the order by clause do not appear to be the culprit as this error
occurs only when the selected data itself exceeds the SQL Server limit
of 8094 characters. Can you (or anyone else reading this) provide any
insight? I would really appreciate it. I'm at a loss of where to go
from here except to start truncating the lengthy varchar strings. I
don't even know if I have the option to do that.
Aaron

Generate XML document problem

I'm having the same problem as described below. Although this was
posted on usenet a few years ago, a solution was not posted, and I
can't find one on the internet anywhere. Does anyone have any idea as
to how I might workaround this? Note that I am not sorting on any of
the varchar fields that are causing the problem.
Thanks,
Aaron

> Here is the problem,
> I need to generate an XML document using FOR XML Explicit. My select
> works fine but I run into a problem when I try to do an order by with
> a row that is greater than 8094 bytes. SQL Server outputs the error
> "Cannot sort a row of size 96555, which is greater than the allowable
> maximum of 8094".
> The order by is very important in my query, because without it. I will
> not get the XML document in the correct schema.
> I have researched this issue and have come to the conclusion there is
> not a way I know of to get around this limitation. I tried using the
> query hint "Robust Plan" and "Force Order" and that did not work.
> A solution that I thought of, but don't know if it will work and how
> to do in SQL server is to first generate the XML schema without the
> TEXT column fields and then do another query to load the text columns
> into the XML document.
> Can I and how do I do all of this in a Stored Procedure?
> Or is there a better workaround for my problem?
> Thanks in advance
>
> --
> B. Harilal
Hi Aaron
Can you please provide some more information? Is it the order by clause that
may contain too much data? Or the rows that you sort?
It would be very useful if you can provide a simple repro.
Thanks
Michael
"AaronS" <gcsdba1@.yahoo.com> wrote in message
news:1140618933.285133.96480@.z14g2000cwz.googlegro ups.com...
> I'm having the same problem as described below. Although this was
> posted on usenet a few years ago, a solution was not posted, and I
> can't find one on the internet anywhere. Does anyone have any idea as
> to how I might workaround this? Note that I am not sorting on any of
> the varchar fields that are causing the problem.
> Thanks,
> Aaron
>
|||Here's an example of what the query is trying to do. I know this query
is not logically correct, but hopefully it gives you an idea of what
the actual query is doing.
SELECT
1 as Tag,
NULL as Parent,
reportID as [reportData!1!id],
NULL as [comments!5!reportCommentID!hide],
NULL as [comment!15!details],
NULL as [Notes!10!reportCaseID!hide],
NULL as [Note!30!noteDesc]
FROM report
UNION ALL
SELECT
15 as Tag,
5 as Parent,
NULL as [reportData!1!id],
reportID as [comments!5!reportCommentID!hide],
details as [comment!15!details] -- varchar(8000)
NULL as [Notes!10!reportCaseID!hide],
NULL as [Note!30!noteDesc]
FROM comment
UNION ALL
SELECT
30 as Tag,
10 as Parent,
NULL as [reportData!1!id],
NULL as [comments!5!reportCommentID!hide],
NULL as [comment!15!details],
reportID as [Notes!10!reportCaseID!hide],
NoteDesc as [Note!30!noteDesc] -- varchar(8000)
FROM note
-- Note that the sort is not on any of the "long" varchar fields
ORDER BY
[reportData!1!id],
[comments!5!reportCommentID!hide]
[Notes!10!reportCaseID!hide]
|||Hi Michael,
I realize my SQL example is very crude (especially since I left out any
join conditions), but does it get the idea across about where the
problem lies? It appears to be the rows I am attempting sort that
contain too much data for SQL Server to handle. The columns specified
in the order by clause do not appear to be the culprit as this error
occurs only when the selected data itself exceeds the SQL Server limit
of 8094 characters. Can you (or anyone else reading this) provide any
insight? I would really appreciate it. I'm at a loss of where to go
from here except to start truncating the lengthy varchar strings. I
don't even know if I have the option to do that.
Aaron

Wednesday, March 7, 2012

Generate Sequence Number based on other columns

Hi,
Please help me to find a solution.

My requirement is similar to this.
Example:

TABLEA(pk_id, pol_mas_id,pol_seq_id)

values are
pk_id pol_mas_id pol_seq_id
1 1
2 1
3 2
4 2
5 3
6 3
7 3

Now i need to update the column "pol_seq_id" as below.

pk_id pol_mas_id pol_seq_id
1 1 1
2 1 2
3 2 1
4 2 2
5 3 1
6 3 2
7 3 3

Currently i am using cursor and you know performance sucks.

Is there any way to increment the data in the column(pol_seq_id) based on other column (pol_mas_id).

Thanks in Advance!!

Try:

select

pk_id, pol_mas_id, row_number() over(partition by pol_mas_id order by pk_id) as pol_seq_id

from

dbo.t1

go

It is helpful to have an index by (pol_mas_id, pk_id)

AMB

|||Thanks a lot for the response !!!
It works for select as when i am trying to update the same i am getting this error
"Windowed functions can only appear in the SELECT or ORDER BY clauses."
so i have populated the same into #temp table and then updated with join statement.

It works
|||

Try using a CTE.

;with cte

as

(

select

pk_id, pol_mas_id, pol_seq_id, row_number() over(partition by pol_mas_id order by pk_id) as rn

from

dbo.t1

go

)

update cte

set pol_seq_id = rn;

AMB

Sunday, February 26, 2012

Generate Report Direct to PDF

Hello All,
I have been asked to find a solution for generating an SSRS report
directly to PDF without the client ever viewing it. There are a couple of
particualrs about our requirements:
1. The report is being called from a third party piece of software
2. We have no, or at most, very limited control of this third party app
(some URL control possible)
3. The location the PDF is to be generated to is static
Any information, links, articles, sample code would be muy, muy appreciated
Gracias
Michael CReporting Services provides a set of Web Services that you can use to get
find targeting report, render it as binery stream in one of the output
format (PDF, XLS, HTML...).
You can simply wite an application to call corresponding web methods of the
reporting services. This application can be any type: desktop, web app or
even Windows services..., based on your need.
I have no idea how the said third part app calls the report. But it is
fairly simple to build a ASP.NET app, which works this way (you need to set
web reference to the report server and know how to consume web services in
your app):
1. User is presented a web page, which allow he to select a report and enter
required report parameters, his email address is also collected, where the
report would be sent to in the format of his choice (PDF, XLS...);
2. When the user submit the web form to server, one of the web methods of
the reporting services is called to render the requested report into binary
stream (PDF or XLS...) and returnd to ASP.NET app;
3. The binary stream of the report is saved to a temporary location on the
ASP.NET app server;
4. The ASP.NET app compose an email, attach the saved report, send the email
to user's email address.
After step 2, of course, you can also stream back the report binary data to
user's browser, in this can, user's browser would prompt user with a
download dialog box. User can choose either open it or save it.
"Michael C" <MichaelC@.discussions.microsoft.com> wrote in message
news:C75284F9-60BA-415C-8D2D-CB41F245A232@.microsoft.com...
> Hello All,
> I have been asked to find a solution for generating an SSRS report
> directly to PDF without the client ever viewing it. There are a couple of
> particualrs about our requirements:
> 1. The report is being called from a third party piece of software
> 2. We have no, or at most, very limited control of this third party app
> (some URL control possible)
> 3. The location the PDF is to be generated to is static
> Any information, links, articles, sample code would be muy, muy
> appreciated
> Gracias
> Michael C|||Thanks Norman,
I'm not too familiar with ASP.NET but necessity is the mother of
invention! Ill give this a shot.
Michael C
"Norman Yuan" wrote:
> Reporting Services provides a set of Web Services that you can use to get
> find targeting report, render it as binery stream in one of the output
> format (PDF, XLS, HTML...).
> You can simply wite an application to call corresponding web methods of the
> reporting services. This application can be any type: desktop, web app or
> even Windows services..., based on your need.
> I have no idea how the said third part app calls the report. But it is
> fairly simple to build a ASP.NET app, which works this way (you need to set
> web reference to the report server and know how to consume web services in
> your app):
> 1. User is presented a web page, which allow he to select a report and enter
> required report parameters, his email address is also collected, where the
> report would be sent to in the format of his choice (PDF, XLS...);
> 2. When the user submit the web form to server, one of the web methods of
> the reporting services is called to render the requested report into binary
> stream (PDF or XLS...) and returnd to ASP.NET app;
> 3. The binary stream of the report is saved to a temporary location on the
> ASP.NET app server;
> 4. The ASP.NET app compose an email, attach the saved report, send the email
> to user's email address.
> After step 2, of course, you can also stream back the report binary data to
> user's browser, in this can, user's browser would prompt user with a
> download dialog box. User can choose either open it or save it.
>
> "Michael C" <MichaelC@.discussions.microsoft.com> wrote in message
> news:C75284F9-60BA-415C-8D2D-CB41F245A232@.microsoft.com...
> > Hello All,
> > I have been asked to find a solution for generating an SSRS report
> > directly to PDF without the client ever viewing it. There are a couple of
> > particualrs about our requirements:
> >
> > 1. The report is being called from a third party piece of software
> > 2. We have no, or at most, very limited control of this third party app
> > (some URL control possible)
> > 3. The location the PDF is to be generated to is static
> >
> > Any information, links, articles, sample code would be muy, muy
> > appreciated
> >
> > Gracias
> > Michael C
>|||You mentioned URL access. You can easily tell reporting services to execute
a report to PDF format by using URL access from you third party application.
When you call the desired report add to the calling URL this name=value pair
" &rs:Format=PDF" (no quotes of course).
--
Thanks, Jim
"Michael C" wrote:
> Thanks Norman,
> I'm not too familiar with ASP.NET but necessity is the mother of
> invention! Ill give this a shot.
> Michael C
>
> "Norman Yuan" wrote:
> > Reporting Services provides a set of Web Services that you can use to get
> > find targeting report, render it as binery stream in one of the output
> > format (PDF, XLS, HTML...).
> >
> > You can simply wite an application to call corresponding web methods of the
> > reporting services. This application can be any type: desktop, web app or
> > even Windows services..., based on your need.
> >
> > I have no idea how the said third part app calls the report. But it is
> > fairly simple to build a ASP.NET app, which works this way (you need to set
> > web reference to the report server and know how to consume web services in
> > your app):
> >
> > 1. User is presented a web page, which allow he to select a report and enter
> > required report parameters, his email address is also collected, where the
> > report would be sent to in the format of his choice (PDF, XLS...);
> >
> > 2. When the user submit the web form to server, one of the web methods of
> > the reporting services is called to render the requested report into binary
> > stream (PDF or XLS...) and returnd to ASP.NET app;
> >
> > 3. The binary stream of the report is saved to a temporary location on the
> > ASP.NET app server;
> >
> > 4. The ASP.NET app compose an email, attach the saved report, send the email
> > to user's email address.
> >
> > After step 2, of course, you can also stream back the report binary data to
> > user's browser, in this can, user's browser would prompt user with a
> > download dialog box. User can choose either open it or save it.
> >
> >
> > "Michael C" <MichaelC@.discussions.microsoft.com> wrote in message
> > news:C75284F9-60BA-415C-8D2D-CB41F245A232@.microsoft.com...
> > > Hello All,
> > > I have been asked to find a solution for generating an SSRS report
> > > directly to PDF without the client ever viewing it. There are a couple of
> > > particualrs about our requirements:
> > >
> > > 1. The report is being called from a third party piece of software
> > > 2. We have no, or at most, very limited control of this third party app
> > > (some URL control possible)
> > > 3. The location the PDF is to be generated to is static
> > >
> > > Any information, links, articles, sample code would be muy, muy
> > > appreciated
> > >
> > > Gracias
> > > Michael C
> >
> >