Showing posts with label queries. Show all posts
Showing posts with label queries. Show all posts

Monday, March 26, 2012

PDF format - Garbled Data

Hello,
I searched for a response from the already posted queries. But I could not
find an answer to the problem that I have.
I have a report that looks fine on the screen and also when exported to
Excel. But
when exported to PDF some textboxes display garbled data. It may be because
of some characters in those textboxes.
Looks like a lot of people have this problem since some time. (I saw a
question that was posted last year related to the same problem)
Is there a solution to this problem?
Thanks,
SangDo you use the right font (has glyphs for these characters)? Is the font
installed on client and server?
--
Nico Cristache [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Sang" <Sang@.discussions.microsoft.com> wrote in message
news:4CE82890-95A9-42E5-9D3F-CD0243FE7AE8@.microsoft.com...
> Hello,
> I searched for a response from the already posted queries. But I could
not
> find an answer to the problem that I have.
> I have a report that looks fine on the screen and also when exported to
> Excel. But
> when exported to PDF some textboxes display garbled data. It may be
because
> of some characters in those textboxes.
> Looks like a lot of people have this problem since some time. (I saw a
> question that was posted last year related to the same problem)
> Is there a solution to this problem?
> Thanks,
> Sang
>|||I am having the same problem. So far it appears to be caused by the data in
the field. If i render the report with different criteria, it comes out ok.
Im curious to see what characters are causing this. It renders perfectly in
HTML though. This is only a problem with the PDF export.
"Nico Cristache [MSFT]" wrote:
> Do you use the right font (has glyphs for these characters)? Is the font
> installed on client and server?
> --
> Nico Cristache [MSFT]
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Sang" <Sang@.discussions.microsoft.com> wrote in message
> news:4CE82890-95A9-42E5-9D3F-CD0243FE7AE8@.microsoft.com...
> > Hello,
> >
> > I searched for a response from the already posted queries. But I could
> not
> > find an answer to the problem that I have.
> >
> > I have a report that looks fine on the screen and also when exported to
> > Excel. But
> > when exported to PDF some textboxes display garbled data. It may be
> because
> > of some characters in those textboxes.
> >
> > Looks like a lot of people have this problem since some time. (I saw a
> > question that was posted last year related to the same problem)
> >
> > Is there a solution to this problem?
> >
> > Thanks,
> > Sang
> >
> >
>
>|||DBCS characters are unreadable in PDF format
Double byte character set (DBCS) characters may fail to display correctly in a report exported to PDF format
From http://www.developmentnow.com/g/115_2004_10_0_0_451494/PDF-format--Garbled-Data.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.comsql

PDF files from SQL queries?

Hi,
Can anyone shed any light on how easy it is to generate PDF reports on the fly from SQL queries. I'd prefer not to use an intermediary report writer, like Crystal.

Presumably I'd need the full product of Adobe Acrobat writer?
How quickly can they be generated?

Any pointers regarding this greatly appreciated...

GregI've been using PHP to pass SQL queries and the FPDF class to generate the pdf files for output. I suppose this would count as using an intermediary report writer, but at least all the bits are free.

Ursus

Originally posted by gregclark
Hi,
Can anyone shed any light on how easy it is to generate PDF reports on the fly from SQL queries. I'd prefer not to use an intermediary report writer, like Crystal.

Presumably I'd need the full product of Adobe Acrobat writer?
How quickly can they be generated?

Any pointers regarding this greatly appreciated...

Greg|||Check out this article.

http://www.sqlservercentral.com/columnists/mivica/creatingapdffromastoredprocedure.asp|||Hi, thanks for the replies. I think i'm going to have to use an intermediate tool such as crystal to get what i want into PDF.

I see that Microsoft have just released Reporting Services for SQL server (http://www.microsoft.com/sql/reporting/default.asp), and there also appears to be a good summary of tools around at this posting (http://www.dbforums.com/showthread.php?threadid=706954),

I'm going to look into these - does anyone know of any other good tools to look at also?

Cheers
g.

Saturday, February 25, 2012

Passing the same variable into a few SQL queries & join them

I have a table that has these fields:
AgentID, Address, RegNo, CnNo, IssueDt, SubmitDt, NoOfDays

Example of data is:

AgentID Address RegNo CnNo IssueDt SubmitDt NoOfDays
1 No 5, Jln Abc KL123 11111 4/12/03 4/15/03 3
1 No 5, Jln Abc KL123 12345 5/10/03 5/20/03 10
1 No 5, Jln Abc KL123 13000 6/13/03 6/13/03 0
1 No 5, Jln Abc KL123 15123 8/15/03 8/16/03 1

NoOfDays actually is DateDiff("d", IssueDt, SubmitDt)

I have to build a report for each Quarter that contains the following:

Agent: 1
Address: No 5, Jln Abc
RegNo: KL123
Total of CN: 3
Total of CN(with Days>0): 2
Days (Min): 3
Days (Max) : 10

This is based on the 2nd quarter (from April to June).

What I did is, I created 3 views.
1)A view that gets Count(CnNo) GROUP BY all the fields HAVING DatePart("quarter", IssueDt) = varQuarter
2)A view that gets Count(CnNo) GROUP BY all the fields HAVING DatePart("quarter", IssueDt) = varQuarter AND NoOfDays > 0
3)A view that gets Min(NoOfDays), Max(NoOfDays) GROUP BY .....HAVING DatePart("quarter", IssueDt) = varQuarter

Right now, I hard code the varQuarter as 2.
After creating all these views, I joined them together to become a view & put all the info in the crystal report to produce the report.

My problem is to make the report dynamic.
I don't know how to pass the Quarter variable into these views.Take the sql for each of the views, place them into a stored procedure, and do the appropriate joins. Replace all your hardcoded varQuarter with @.VarQuarter and define @.VarQuarter as an input parameter for the stored procedure.

Then call it like this:


EXEC BigReportQuery @.VarQuarter=3

The definition of BigReportQuery would start like this:

CREATE PROCEDURE [dbo].[BigReportQuery]
@.VarQuarter int
AS
SELECT x,y,z FROM SomeTable INNER JOIN ... HAVING DatePart("quarter",IssueDt)=@.VarQuarter ... etc.
GO

Alternatively, just combine calls to each of the existing views but from within the stored procedure.