Monday, March 26, 2012
GDI+ error when using TIFF in PRINTERDELIVERY sample
I'm playing with the Printerdelivery sample in 2005 and having problems.
1. When I use the EMF Image type the printout for the rendered report is
larger then expected. The fonts seem larger and the lines of text are cut
off. I tried modifying the Device Info and add the DpiX and DpiY to 300, but
this gave me the same thing. Why does EMF make the rendered report larger
then expected.
2. When trying a diffent type such as TIFF I get the error "A generic error
occurred in GDI+." I don't know what this error my be indicating. Here is
my line from the sample
deviceInfo = String.Format(
System.Globalization.CultureInfo.InvariantCulture,
@."<DeviceInfo><OutputFormat>{0}</OutputFormat><StartPage>{1}</StartPage><PageHeight>{2}</PageHeight><PageWidth>{3}</PageWidth></DeviceInfo>",
"tiff", startPage, pageHeight, pageWidth);
Any help greatly apprciated.
David BotzenhartI'm having the same problem...did you find a resolution?
Thanks,
Gary
"David Botzenhart" wrote:
> Hi,
> I'm playing with the Printerdelivery sample in 2005 and having problems.
> 1. When I use the EMF Image type the printout for the rendered report is
> larger then expected. The fonts seem larger and the lines of text are cut
> off. I tried modifying the Device Info and add the DpiX and DpiY to 300, but
> this gave me the same thing. Why does EMF make the rendered report larger
> then expected.
> 2. When trying a diffent type such as TIFF I get the error "A generic error
> occurred in GDI+." I don't know what this error my be indicating. Here is
> my line from the sample
> deviceInfo = String.Format(
> System.Globalization.CultureInfo.InvariantCulture,
> @."<DeviceInfo><OutputFormat>{0}</OutputFormat><StartPage>{1}</StartPage><PageHeight>{2}</PageHeight><PageWidth>{3}</PageWidth></DeviceInfo>",
> "tiff", startPage, pageHeight, pageWidth);
>
> Any help greatly apprciated.
>
> David Botzenhart
>
>|||Check this out...
http://www.sqlmonster.com/Uwe/Forum.aspx/sql-server-reporting/3566/Printer-Delivery-Extension-Font-Problem
"GaryV" wrote:
> I'm having the same problem...did you find a resolution?
> Thanks,
> Gary
>
> "David Botzenhart" wrote:
> > Hi,
> >
> > I'm playing with the Printerdelivery sample in 2005 and having problems.
> >
> > 1. When I use the EMF Image type the printout for the rendered report is
> > larger then expected. The fonts seem larger and the lines of text are cut
> > off. I tried modifying the Device Info and add the DpiX and DpiY to 300, but
> > this gave me the same thing. Why does EMF make the rendered report larger
> > then expected.
> >
> > 2. When trying a diffent type such as TIFF I get the error "A generic error
> > occurred in GDI+." I don't know what this error my be indicating. Here is
> > my line from the sample
> >
> > deviceInfo = String.Format(
> >
> > System.Globalization.CultureInfo.InvariantCulture,
> >
> > @."<DeviceInfo><OutputFormat>{0}</OutputFormat><StartPage>{1}</StartPage><PageHeight>{2}</PageHeight><PageWidth>{3}</PageWidth></DeviceInfo>",
> >
> > "tiff", startPage, pageHeight, pageWidth);
> >
> >
> >
> > Any help greatly apprciated.
> >
> >
> >
> > David Botzenhart
> >
> >
> >
Monday, March 12, 2012
function using comparing dates not working right
I'm trying to write a function to return all notes with date. Sample data for 1 record=187189 as follows:
iincidentid,iWorkNoteId,iSeqnum, dtEntryDate, workNoteAll
187189 3440 1 2006-04-24 note1
187189 3545 1 2006-06-22 note2
187189 3547 1 2006-06-22 note3
187189 3653 1 2006-08-10 note4
187189 3653 2 2006-08-10 note5
funtion will return = 2006_08-10 note4 note5 for iincidentid=187189
----------------
CREATE FUNCTION dbo.getIncidentNotesRev(@.iIncidentID int)
RETURNS varchar(8000)
AS
BEGIN
declare @.incidentId int
declare @.worknoteid int
declare @.worknotesaveid int
declare @.seqnum int
declare @.dtEntryDate smalldatetime
declare @.worknoteall varchar(8000)
declare @.allnotes varchar(8000)
declare @.currentWEDate smalldatetime
declare @.beginWEDate smalldatetime
select @.allnotes=''
select @.currentWEDate=currentweekEndDate from csCurrentweekEndDate --get the current week end date
select @.beginWEDate = DATEADD(d, - 28, @.currentWEDate)--get the last 4 weeks
declare CursorIncident CURSOR
LOCAL FOR SELECT iIncidentId, iWorkNoteID, iSeqNum, dtEntryDate,worknoteall FROM dbo.rpt_weekly_prospect_status_vw
where iIncidentId=@.iIncidentID order by iWorkNoteId
OPEN CursorIncident
FETCH NEXT FROM CursorIncident INTO @.incidentId,@.worknoteid,@.seqnum,@.dtEntryDate,@.work noteall
--store 1st record of cursor
select @.worknotesaveid =@.worknoteid
WHILE (@.@.FETCH_STATUS=0)
BEGIN
if @.dtEntryDate >=@.beginWEDate AND @.dtEntryDate <= @.currentWEDate
Begin
if @.worknotesaveid <> @.worknoteid
Begin
Select @.allnotes = @.allnotes + @.dtEntryDate + @.worknoteall
End
else
BEgin
select @.allnotes = @.allnotes + @.worknoteall
End
select @.worknotesaveid = @.worknoteid --save next worknoteId
End
else
Begin
select @.allnotes=''
End
FETCH NEXT FROM CursorIncident INTO @.incidentId,@.worknoteid,@.seqnum,@.dtEntryDate,@.work noteall
END --WHILE (@.@.FETCH_STATUS=0)
CLOSE CursorIncident
DEALLOCATE CursorIncident
return @.allnotes
END
----
Function not working right. I appreciate any help.
Thanks in advance.There is a problem with you logic. If there is more than one dtEntryDate value for an incidentId within the past four weeks, which date should your function return? It is only able to return a single date value.
Think about it.
In the meantime, here is a bit of wisdom: If you find yourself using a cursor, you are either an SQL guru or you are doing something wrong.
This is the type of logic you want to use (returns only notes, because unclear of date issue above):CREATE FUNCTION dbo.getIncidentNotesRev(@.iIncidentID int)
RETURNS varchar(8000)
AS
BEGIN
declare @.allnotes varchar(8000)
declare @.currentWEDate smalldatetime
declare @.beginWEDate smalldatetime
select @.currentWEDate=currentweekEndDate from csCurrentweekEndDate --get the current week end date
select @.beginWEDate = DATEADD(d, - 28, @.currentWEDate)--get the last 4 weeks
select @.AllNotes = Coalesce(@.AllNotes, '') + worknoteall
from dbo.rpt_weekly_prospect_status_vw
where iIncidentId=@.iIncidentID
and dtEntryDate between @.beginWEDate and @.currentWEDate
order by iWorkNoteId
return @.AllNotes
End|||Hi,
In my example above, it should return only the date for note4 and note5 (they are the same) since they have the same iWorkNoteId. In my code I'm checking that; otherwise, if the iWorkNoteId is different, then the date for that note is added to the @.allnotes.
I originally have a similar code as yours, but then I need to modify it because the users need the last 4 weeks notes in which the date is also a part of the allnotes.
I ran your code but it's alwyas giving NUll, although there is data. I think the date comparison is not working.
Thanks.|||Fine...what you supplied with the sample data and expected results is perfect...I just decided not to go through your code...
But this does what you want
USE Northwind
GO
CREATE TABLE myTable99(Incident int, col2 int, col3 int, col4 datetime, note char(10))
GO
INSERT INTO myTable99(Incident, col2, col3, col4, note)
SELECT 187189, 3440, 1, '2006-04-24', 'note1' UNION ALL
SELECT 187189, 3545, 1, '2006-06-22', 'note2' UNION ALL
SELECT 187189, 3547, 1, '2006-06-22', 'note3' UNION ALL
SELECT 187189, 3653, 1, '2006-08-10', 'note4' UNION ALL
SELECT 187189, 3653, 2, '2006-08-10', 'note5'
GO
SELECT * FROM myTable99
GO
SELECT *
FROM myTable99 o
WHERE EXISTS (
SELECT Incident
FROM myTable99 i
WHERE i.Incident = o.Incident
GROUP BY Incident
HAVING o.Col4 = MAX(i.Col4))
GO
DROP TABLE myTable99
GO
Wednesday, March 7, 2012
Function
CREATE FUNCTION LargeOrderShippers ( @.FreightParm money )
RETURNS @.OrderShipperTab TABLE
(
ShipperID int,
ShipperName nvarchar(80),
OrderID int,
ShippedDate datetime,
Freight money
)
AS
BEGIN
INSERT @.OrderShipperTab
SELECT S.ShipperID, S.CompanyName,
O.OrderID, O.ShippedDate, O.Freight
FROM Shippers AS S INNER JOIN Orders AS O
ON S.ShipperID = O.ShipVia
WHERE O.Freight > @.FreightParm
RETURN
SQ analyser displays the following:
Server: Msg 170, Level 15, State 1, Procedure LargeOrderShippers, Line 18
Line 18: Incorrect syntax near 'RETURN'.
Please advise.
Thanks much.
|||Try this link for all the info you need about UDF (user defined functions), the person who runs the site is a UDF expert. Hope this helps.
http://www.novicksoftware.com/UDFofWeek/Vol1/T-SQL-UDF-Volume-1-Number-38-udf_DT_AddTime.htm|||check thislink|||
The syntax for it is :
create function <function name ( param 1 <datatype>,...)>
returns table
as
return
select .....
go
Hope this solves your query...
Cheers
Ajay G
Thanks much.
Sunday, February 26, 2012
Fulltext Search, Contains, Varbinary, AdvantureWorks
Hello all
I am trying to full text search in the Documnt table in AdvantureWorks DB.
as in the video sample microsoft provided.
I create the unique index on DocumentID column and created the FullTextIndex:
create fulltext index on Production.Document
(
Document
Type column FileExtension
Language 0X0
)
Key index ui_ProductionDocument on MyFullTextCatalog
With change_tracking auto
Now I am trying to run the next search:
select * from Production.Document
where Contains(Document,'?????')
and I get nothing back, what do I do wrong?
I was having a pending restart that fixed the all thing.
Don't know why....