Showing posts with label services. Show all posts
Showing posts with label services. Show all posts

Thursday, March 22, 2012

Delegation stops working after a while

I have a linked server set up between two servers (A & B).
Server A is running 2005 and Server B is running 2000.
Both servers SQL services are running using a domain user account and have
their SPN's registered in the AD.
The client connects to Server A using integrated security (TCP/IP and
Kerberos not NTLM) and runs disributed queries using the linked server to
server B.
Delegation is set up in the AD and is working, at least for some time.
After a while (sometimes a couple of minutes, sometimes a couple of hours)
the delegation seems to stop working and the client recieves the error
"Login
failed for user '(null)'. Reason: Not associated with a trusted SQL Server
connection." The client is still connected and authenticated using TCP/IP
and
Kerberos.
After a restart of SQL Server on server A the delegation starts working
again.
I cannt find anything in the eventlogs on either one of the servers or the
client, and nothing in the sql server logs.
Does anybody have any idea of what could be wrong, or give me a though on
where to start looking.
Thanks
/MattiasWe are encountering this problem also. I have contacted MS but they are
still gathering information.
There is at least one other unanswered post on this here as well, see
subject = "SQL2005 Linked server authentication drops".
Are you running sql server under under a domain account that is not in the
local admins group by any chance?
--
-b
"Mattias" wrote:
> I have a linked server set up between two servers (A & B).
> Server A is running 2005 and Server B is running 2000.
> Both servers SQL services are running using a domain user account and have
> their SPN's registered in the AD.
> The client connects to Server A using integrated security (TCP/IP and
> Kerberos not NTLM) and runs disributed queries using the linked server to
> server B.
> Delegation is set up in the AD and is working, at least for some time.
> After a while (sometimes a couple of minutes, sometimes a couple of hours)
> the delegation seems to stop working and the client recieves the error
> "Login
> failed for user '(null)'. Reason: Not associated with a trusted SQL Server
> connection." The client is still connected and authenticated using TCP/IP
> and
> Kerberos.
> After a restart of SQL Server on server A the delegation starts working
> again.
> I cannt find anything in the eventlogs on either one of the servers or the
> client, and nothing in the sql server logs.
> Does anybody have any idea of what could be wrong, or give me a though on
> where to start looking.
> Thanks
> /Mattias
>
>|||I am the other unanswered posting!
It fails intermittently when we run under 'sa' or a domain account that is
in the local admin group.
I have raised this through the Microsoft concierge service and they said
there are others with the same problem but no resolutions as yet!
Wendy
"BBogart" wrote:
> We are encountering this problem also. I have contacted MS but they are
> still gathering information.
> There is at least one other unanswered post on this here as well, see
> subject = "SQL2005 Linked server authentication drops".
> Are you running sql server under under a domain account that is not in the
> local admins group by any chance?
> --
> -b
>
> "Mattias" wrote:
> > I have a linked server set up between two servers (A & B).
> > Server A is running 2005 and Server B is running 2000.
> > Both servers SQL services are running using a domain user account and have
> > their SPN's registered in the AD.
> >
> > The client connects to Server A using integrated security (TCP/IP and
> > Kerberos not NTLM) and runs disributed queries using the linked server to
> > server B.
> > Delegation is set up in the AD and is working, at least for some time.
> >
> > After a while (sometimes a couple of minutes, sometimes a couple of hours)
> > the delegation seems to stop working and the client recieves the error
> > "Login
> > failed for user '(null)'. Reason: Not associated with a trusted SQL Server
> > connection." The client is still connected and authenticated using TCP/IP
> > and
> > Kerberos.
> >
> > After a restart of SQL Server on server A the delegation starts working
> > again.
> >
> > I cannt find anything in the eventlogs on either one of the servers or the
> > client, and nothing in the sql server logs.
> >
> > Does anybody have any idea of what could be wrong, or give me a though on
> > where to start looking.
> >
> > Thanks
> > /Mattias
> >
> >
> >|||We have seen this in our environment too. One moment a linked server query
will work just fine with delegated Windows credentials, the next moment you
receive errors like the following:
OLE DB provider "SQLNCLI" for linked server "THESERVER" returned message
"Communication link failure".
Msg 10054, Level 16, State 1, Line 0
TCP Provider: An existing connection was forcibly closed by the remote host.
Msg 18452, Level 14, State 1, Line 0
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
I am still working on a reproducable way of generating the message, but I
seem to have problems a lot when I initially generate a linked server within
SQL Management Studio 2005. My connections rarely last beyond 24 hours, and
I suspect that something in the Kerberos token is expiring. After I logout
and login, I can usually start a new session that works (just not today).
"Woo" wrote:
> I am the other unanswered posting!
> It fails intermittently when we run under 'sa' or a domain account that is
> in the local admin group.
> I have raised this through the Microsoft concierge service and they said
> there are others with the same problem but no resolutions as yet!
> Wendy
>
>
> "BBogart" wrote:
> > We are encountering this problem also. I have contacted MS but they are
> > still gathering information.
> >
> > There is at least one other unanswered post on this here as well, see
> > subject = "SQL2005 Linked server authentication drops".
> >
> > Are you running sql server under under a domain account that is not in the
> > local admins group by any chance?
> > --
> > -b
> >
> >
> > "Mattias" wrote:
> >
> > > I have a linked server set up between two servers (A & B).
> > > Server A is running 2005 and Server B is running 2000.
> > > Both servers SQL services are running using a domain user account and have
> > > their SPN's registered in the AD.
> > >
> > > The client connects to Server A using integrated security (TCP/IP and
> > > Kerberos not NTLM) and runs disributed queries using the linked server to
> > > server B.
> > > Delegation is set up in the AD and is working, at least for some time.
> > >
> > > After a while (sometimes a couple of minutes, sometimes a couple of hours)
> > > the delegation seems to stop working and the client recieves the error
> > > "Login
> > > failed for user '(null)'. Reason: Not associated with a trusted SQL Server
> > > connection." The client is still connected and authenticated using TCP/IP
> > > and
> > > Kerberos.
> > >
> > > After a restart of SQL Server on server A the delegation starts working
> > > again.
> > >
> > > I cannt find anything in the eventlogs on either one of the servers or the
> > > client, and nothing in the sql server logs.
> > >
> > > Does anybody have any idea of what could be wrong, or give me a though on
> > > where to start looking.
> > >
> > > Thanks
> > > /Mattias
> > >
> > >
> > >|||I also suspect a ticket is expiring.
I am still working with MS on this with no resolution yet.
Once we see a failure, failures continue regardless of logging off and back
on until sql server is restarted. A reboot is not necessary as I previously
thought.
We have seen it take as little as a few hours or up to a week or more for
the failures to start again.
--
-b
"JD Qixcle" wrote:
> We have seen this in our environment too. One moment a linked server query
> will work just fine with delegated Windows credentials, the next moment you
> receive errors like the following:
> OLE DB provider "SQLNCLI" for linked server "THESERVER" returned message
> "Communication link failure".
> Msg 10054, Level 16, State 1, Line 0
> TCP Provider: An existing connection was forcibly closed by the remote host.
> Msg 18452, Level 14, State 1, Line 0
> Login failed for user '(null)'. Reason: Not associated with a trusted SQL
> Server connection.
> I am still working on a reproducable way of generating the message, but I
> seem to have problems a lot when I initially generate a linked server within
> SQL Management Studio 2005. My connections rarely last beyond 24 hours, and
> I suspect that something in the Kerberos token is expiring. After I logout
> and login, I can usually start a new session that works (just not today).
>
>
> "Woo" wrote:
> > I am the other unanswered posting!
> >
> > It fails intermittently when we run under 'sa' or a domain account that is
> > in the local admin group.
> >
> > I have raised this through the Microsoft concierge service and they said
> > there are others with the same problem but no resolutions as yet!
> >
> > Wendy
> >
> >
> >
> >
> > "BBogart" wrote:
> >
> > > We are encountering this problem also. I have contacted MS but they are
> > > still gathering information.
> > >
> > > There is at least one other unanswered post on this here as well, see
> > > subject = "SQL2005 Linked server authentication drops".
> > >
> > > Are you running sql server under under a domain account that is not in the
> > > local admins group by any chance?
> > > --
> > > -b
> > >
> > >
> > > "Mattias" wrote:
> > >
> > > > I have a linked server set up between two servers (A & B).
> > > > Server A is running 2005 and Server B is running 2000.
> > > > Both servers SQL services are running using a domain user account and have
> > > > their SPN's registered in the AD.
> > > >
> > > > The client connects to Server A using integrated security (TCP/IP and
> > > > Kerberos not NTLM) and runs disributed queries using the linked server to
> > > > server B.
> > > > Delegation is set up in the AD and is working, at least for some time.
> > > >
> > > > After a while (sometimes a couple of minutes, sometimes a couple of hours)
> > > > the delegation seems to stop working and the client recieves the error
> > > > "Login
> > > > failed for user '(null)'. Reason: Not associated with a trusted SQL Server
> > > > connection." The client is still connected and authenticated using TCP/IP
> > > > and
> > > > Kerberos.
> > > >
> > > > After a restart of SQL Server on server A the delegation starts working
> > > > again.
> > > >
> > > > I cannt find anything in the eventlogs on either one of the servers or the
> > > > client, and nothing in the sql server logs.
> > > >
> > > > Does anybody have any idea of what could be wrong, or give me a though on
> > > > where to start looking.
> > > >
> > > > Thanks
> > > > /Mattias
> > > >
> > > >
> > > >|||Did you have this issue resolved ?
Any hints / links /pointers/ thots will be appreciated
Thanks,
GA
"BBogart" wrote:
> I also suspect a ticket is expiring.
> I am still working with MS on this with no resolution yet.
> Once we see a failure, failures continue regardless of logging off and back
> on until sql server is restarted. A reboot is not necessary as I previously
> thought.
> We have seen it take as little as a few hours or up to a week or more for
> the failures to start again.
> --
> -b
> "JD Qixcle" wrote:
> > We have seen this in our environment too. One moment a linked server query
> > will work just fine with delegated Windows credentials, the next moment you
> > receive errors like the following:
> >
> > OLE DB provider "SQLNCLI" for linked server "THESERVER" returned message
> > "Communication link failure".
> > Msg 10054, Level 16, State 1, Line 0
> > TCP Provider: An existing connection was forcibly closed by the remote host.
> > Msg 18452, Level 14, State 1, Line 0
> > Login failed for user '(null)'. Reason: Not associated with a trusted SQL
> > Server connection.
> >
> > I am still working on a reproducable way of generating the message, but I
> > seem to have problems a lot when I initially generate a linked server within
> > SQL Management Studio 2005. My connections rarely last beyond 24 hours, and
> > I suspect that something in the Kerberos token is expiring. After I logout
> > and login, I can usually start a new session that works (just not today).
> >
> >
> >
> >
> > "Woo" wrote:
> >
> > > I am the other unanswered posting!
> > >
> > > It fails intermittently when we run under 'sa' or a domain account that is
> > > in the local admin group.
> > >
> > > I have raised this through the Microsoft concierge service and they said
> > > there are others with the same problem but no resolutions as yet!
> > >
> > > Wendy
> > >
> > >
> > >
> > >
> > > "BBogart" wrote:
> > >
> > > > We are encountering this problem also. I have contacted MS but they are
> > > > still gathering information.
> > > >
> > > > There is at least one other unanswered post on this here as well, see
> > > > subject = "SQL2005 Linked server authentication drops".
> > > >
> > > > Are you running sql server under under a domain account that is not in the
> > > > local admins group by any chance?
> > > > --
> > > > -b
> > > >
> > > >
> > > > "Mattias" wrote:
> > > >
> > > > > I have a linked server set up between two servers (A & B).
> > > > > Server A is running 2005 and Server B is running 2000.
> > > > > Both servers SQL services are running using a domain user account and have
> > > > > their SPN's registered in the AD.
> > > > >
> > > > > The client connects to Server A using integrated security (TCP/IP and
> > > > > Kerberos not NTLM) and runs disributed queries using the linked server to
> > > > > server B.
> > > > > Delegation is set up in the AD and is working, at least for some time.
> > > > >
> > > > > After a while (sometimes a couple of minutes, sometimes a couple of hours)
> > > > > the delegation seems to stop working and the client recieves the error
> > > > > "Login
> > > > > failed for user '(null)'. Reason: Not associated with a trusted SQL Server
> > > > > connection." The client is still connected and authenticated using TCP/IP
> > > > > and
> > > > > Kerberos.
> > > > >
> > > > > After a restart of SQL Server on server A the delegation starts working
> > > > > again.
> > > > >
> > > > > I cannt find anything in the eventlogs on either one of the servers or the
> > > > > client, and nothing in the sql server logs.
> > > > >
> > > > > Does anybody have any idea of what could be wrong, or give me a though on
> > > > > where to start looking.
> > > > >
> > > > > Thanks
> > > > > /Mattias
> > > > >
> > > > >
> > > > >|||--
-b
"DallasBlue" wrote:
> Did you have this issue resolved ?
> Any hints / links /pointers/ thots will be appreciated
> Thanks,
> GA
> "BBogart" wrote:
> > I also suspect a ticket is expiring.
> >
> > I am still working with MS on this with no resolution yet.
> >
> > Once we see a failure, failures continue regardless of logging off and back
> > on until sql server is restarted. A reboot is not necessary as I previously
> > thought.
> >
> > We have seen it take as little as a few hours or up to a week or more for
> > the failures to start again.
> > --
> > -b
> >
> > "JD Qixcle" wrote:
> >
> > > We have seen this in our environment too. One moment a linked server query
> > > will work just fine with delegated Windows credentials, the next moment you
> > > receive errors like the following:
> > >
> > > OLE DB provider "SQLNCLI" for linked server "THESERVER" returned message
> > > "Communication link failure".
> > > Msg 10054, Level 16, State 1, Line 0
> > > TCP Provider: An existing connection was forcibly closed by the remote host.
> > > Msg 18452, Level 14, State 1, Line 0
> > > Login failed for user '(null)'. Reason: Not associated with a trusted SQL
> > > Server connection.
> > >
> > > I am still working on a reproducable way of generating the message, but I
> > > seem to have problems a lot when I initially generate a linked server within
> > > SQL Management Studio 2005. My connections rarely last beyond 24 hours, and
> > > I suspect that something in the Kerberos token is expiring. After I logout
> > > and login, I can usually start a new session that works (just not today).
> > >
> > >
> > >
> > >
> > > "Woo" wrote:
> > >
> > > > I am the other unanswered posting!
> > > >
> > > > It fails intermittently when we run under 'sa' or a domain account that is
> > > > in the local admin group.
> > > >
> > > > I have raised this through the Microsoft concierge service and they said
> > > > there are others with the same problem but no resolutions as yet!
> > > >
> > > > Wendy
> > > >
> > > >
> > > >
> > > >
> > > > "BBogart" wrote:
> > > >
> > > > > We are encountering this problem also. I have contacted MS but they are
> > > > > still gathering information.
> > > > >
> > > > > There is at least one other unanswered post on this here as well, see
> > > > > subject = "SQL2005 Linked server authentication drops".
> > > > >
> > > > > Are you running sql server under under a domain account that is not in the
> > > > > local admins group by any chance?
> > > > > --
> > > > > -b
> > > > >
> > > > >
> > > > > "Mattias" wrote:
> > > > >
> > > > > > I have a linked server set up between two servers (A & B).
> > > > > > Server A is running 2005 and Server B is running 2000.
> > > > > > Both servers SQL services are running using a domain user account and have
> > > > > > their SPN's registered in the AD.
> > > > > >
> > > > > > The client connects to Server A using integrated security (TCP/IP and
> > > > > > Kerberos not NTLM) and runs disributed queries using the linked server to
> > > > > > server B.
> > > > > > Delegation is set up in the AD and is working, at least for some time.
> > > > > >
> > > > > > After a while (sometimes a couple of minutes, sometimes a couple of hours)
> > > > > > the delegation seems to stop working and the client recieves the error
> > > > > > "Login
> > > > > > failed for user '(null)'. Reason: Not associated with a trusted SQL Server
> > > > > > connection." The client is still connected and authenticated using TCP/IP
> > > > > > and
> > > > > > Kerberos.
> > > > > >
> > > > > > After a restart of SQL Server on server A the delegation starts working
> > > > > > again.
> > > > > >
> > > > > > I cannt find anything in the eventlogs on either one of the servers or the
> > > > > > client, and nothing in the sql server logs.
> > > > > >
> > > > > > Does anybody have any idea of what could be wrong, or give me a though on
> > > > > > where to start looking.
> > > > > >
> > > > > > Thanks
> > > > > > /Mattias
> > > > > >
> > > > > >
> > > > > >

Delegation stops working after a while

I have a linked server set up between two servers (A & B).
Server A is running 2005 and Server B is running 2000.
Both servers SQL services are running using a domain user account and have
their SPN's registered in the AD.
The client connects to Server A using integrated security (TCP/IP and
Kerberos not NTLM) and runs disributed queries using the linked server to
server B.
Delegation is set up in the AD and is working, at least for some time.
After a while (sometimes a couple of minutes, sometimes a couple of hours)
the delegation seems to stop working and the client recieves the error
"Login
failed for user '(null)'. Reason: Not associated with a trusted SQL Server
connection." The client is still connected and authenticated using TCP/IP
and
Kerberos.
After a restart of SQL Server on server A the delegation starts working
again.
I cannt find anything in the eventlogs on either one of the servers or the
client, and nothing in the sql server logs.
Does anybody have any idea of what could be wrong, or give me a though on
where to start looking.
Thanks
/MattiasWe are encountering this problem also. I have contacted MS but they are
still gathering information.
There is at least one other unanswered post on this here as well, see
subject = "SQL2005 Linked server authentication drops".
Are you running sql server under under a domain account that is not in the
local admins group by any chance?
--
-b
"Mattias" wrote:

> I have a linked server set up between two servers (A & B).
> Server A is running 2005 and Server B is running 2000.
> Both servers SQL services are running using a domain user account and have
> their SPN's registered in the AD.
> The client connects to Server A using integrated security (TCP/IP and
> Kerberos not NTLM) and runs disributed queries using the linked server to
> server B.
> Delegation is set up in the AD and is working, at least for some time.
> After a while (sometimes a couple of minutes, sometimes a couple of hours)
> the delegation seems to stop working and the client recieves the error
> "Login
> failed for user '(null)'. Reason: Not associated with a trusted SQL Server
> connection." The client is still connected and authenticated using TCP/IP
> and
> Kerberos.
> After a restart of SQL Server on server A the delegation starts working
> again.
> I cannt find anything in the eventlogs on either one of the servers or the
> client, and nothing in the sql server logs.
> Does anybody have any idea of what could be wrong, or give me a though on
> where to start looking.
> Thanks
> /Mattias
>
>|||I am the other unanswered posting!
It fails intermittently when we run under 'sa' or a domain account that is
in the local admin group.
I have raised this through the Microsoft concierge service and they said
there are others with the same problem but no resolutions as yet!
Wendy
"BBogart" wrote:
[vbcol=seagreen]
> We are encountering this problem also. I have contacted MS but they are
> still gathering information.
> There is at least one other unanswered post on this here as well, see
> subject = "SQL2005 Linked server authentication drops".
> Are you running sql server under under a domain account that is not in the
> local admins group by any chance?
> --
> -b
>
> "Mattias" wrote:
>|||We have seen this in our environment too. One moment a linked server query
will work just fine with delegated Windows credentials, the next moment you
receive errors like the following:
OLE DB provider "SQLNCLI" for linked server "THESERVER" returned message
"Communication link failure".
Msg 10054, Level 16, State 1, Line 0
TCP Provider: An existing connection was forcibly closed by the remote host.
Msg 18452, Level 14, State 1, Line 0
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
I am still working on a reproducable way of generating the message, but I
seem to have problems a lot when I initially generate a linked server within
SQL Management Studio 2005. My connections rarely last beyond 24 hours, and
I suspect that something in the Kerberos token is expiring. After I logout
and login, I can usually start a new session that works (just not today).
"Woo" wrote:
[vbcol=seagreen]
> I am the other unanswered posting!
> It fails intermittently when we run under 'sa' or a domain account that is
> in the local admin group.
> I have raised this through the Microsoft concierge service and they said
> there are others with the same problem but no resolutions as yet!
> Wendy
>
>
> "BBogart" wrote:
>|||I also suspect a ticket is expiring.
I am still working with MS on this with no resolution yet.
Once we see a failure, failures continue regardless of logging off and back
on until sql server is restarted. A reboot is not necessary as I previously
thought.
We have seen it take as little as a few hours or up to a week or more for
the failures to start again.
--
-b
"JD Qixcle" wrote:
[vbcol=seagreen]
> We have seen this in our environment too. One moment a linked server quer
y
> will work just fine with delegated Windows credentials, the next moment yo
u
> receive errors like the following:
> OLE DB provider "SQLNCLI" for linked server "THESERVER" returned message
> "Communication link failure".
> Msg 10054, Level 16, State 1, Line 0
> TCP Provider: An existing connection was forcibly closed by the remote hos
t.
> Msg 18452, Level 14, State 1, Line 0
> Login failed for user '(null)'. Reason: Not associated with a trusted SQL
> Server connection.
> I am still working on a reproducable way of generating the message, but I
> seem to have problems a lot when I initially generate a linked server with
in
> SQL Management Studio 2005. My connections rarely last beyond 24 hours, a
nd
> I suspect that something in the Kerberos token is expiring. After I logou
t
> and login, I can usually start a new session that works (just not today).
>
>
> "Woo" wrote:
>|||Did you have this issue resolved ?
Any hints / links /pointers/ thots will be appreciated
Thanks,
GA
"BBogart" wrote:
[vbcol=seagreen]
> I also suspect a ticket is expiring.
> I am still working with MS on this with no resolution yet.
> Once we see a failure, failures continue regardless of logging off and bac
k
> on until sql server is restarted. A reboot is not necessary as I previous
ly
> thought.
> We have seen it take as little as a few hours or up to a week or more for
> the failures to start again.
> --
> -b
> "JD Qixcle" wrote:
>|||-b
"DallasBlue" wrote:
[vbcol=seagreen]
> Did you have this issue resolved ?
> Any hints / links /pointers/ thots will be appreciated
> Thanks,
> GA
> "BBogart" wrote:
>

Delegation And Windows 2003

I have the following scenario:
Machine 1: IIS Server - running Reporting Services
Machine 2: SQL Server - stores all data that a report will use
These servers run in a Windows 2000 Active Directory domain.
The IIS web site has the directory security set to Windows authentication
and Anonymouse authentication unchecked.
The reports use a shared data source that has the Windows authentication
checkbox checked.
The IIS Server has the delegation checkbox checked in Active Directories and
Users.
Run the report from a browser and get the login failed for the anonymous
user. Run the report from the IIS Server and it works. This is a sure
indication of a delegation issue.
What am I missing?Hi,
From your descriptions, I understood that running the report from a browser
and get the login failed for the anonymous user. Run the report from the
IIS Server and it works. Have I understood you? Correct me if I was wrong.
Based on my socpe, it seems to be a Kerberos issue and the simplest
workaround is changing the shared data source to use SQL authentication to
the SQL Server.
To set up delegation on a computer, the following conditions must be met:
* The account doing the delegation must be set to Trusted for delegation to
any service or Trusted for delegation to specified services only.
* The account that the service is delegating for must not have the Account
is sensitive and cannot be delegated option chosen.
* An administrator must have the Enable computer and user accounts to be
trusted for delegation privilege on the computer in order to enable
delegation.
See the following knowledge base article for more detailed information
Basic Overview of Kerberos User Authentication Protocol in Windows 2000
http://support.microsoft.com/kb/217098
Thank you for your patience and corporation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!
Sincerely yours,
Michael Cheng
Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
---
Get Secure! - http://www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks!sql

Delayed Send

Hi

My application sends notifications by creating a once-off subcription, then raising an event in Notification Services. This causes the notification to be issued immediately.

I want to be able to create a notification that is not sent until some time in the future. I'm not sure if I should be looking at ScheduledRules or EventRules.

Has anyone done anything similar?

Thanks

Robert.

Event driven rules produce notifications as events come into the notification application. Scheduled rules create notifications according to the schedule defined in the subscription. Take a look at the ScheduleRecurrence and ScheduleStart properties of the Subscription class.

HTH...

Joe

Sunday, March 11, 2012

defrag using deskeeper 2007

Is there anything I need to be aware of when I defrag my SQL 2000 server
using deskeeper 2007? Do I need to stop the services or anything else?
Thanks,
IIRC, Diskeeper claims that there server product will defrag sql database
files while sql is still running. I could be misremembering this. I do
have several clients that have done that without any corruptions.
Having said that - stop your sql server. Best not to take the chance, IMHO.
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net
"Dooma" <nowhere@.noway.com> wrote in message
news:OW1mw8lnIHA.980@.TK2MSFTNGP06.phx.gbl...
> Is there anything I need to be aware of when I defrag my SQL 2000 server
> using deskeeper 2007? Do I need to stop the services or anything else?
>
> Thanks,
>
>
|||Do you really need to defrag your filesystem?
Linchi
"Dooma" wrote:

> Is there anything I need to be aware of when I defrag my SQL 2000 server
> using deskeeper 2007? Do I need to stop the services or anything else?
>
> Thanks,
>
>
|||Not sure about this poster's need, but I have certainly had client's that
needed to defrag their file system. 300K+ file fragments (which I have seen
at a client) in their database file directory WILL affect performance! :-)
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
news:6A544A98-8CCE-433F-85FE-3718DCD793AE@.microsoft.com...[vbcol=seagreen]
> Do you really need to defrag your filesystem?
> Linchi
> "Dooma" wrote:

defrag using deskeeper 2007

Is there anything I need to be aware of when I defrag my SQL 2000 server
using deskeeper 2007? Do I need to stop the services or anything else?
Thanks,"Dooma" <nowhere@.noway.com> wrote in message
news:OW1mw8lnIHA.980@.TK2MSFTNGP06.phx.gbl...
> Is there anything I need to be aware of when I defrag my SQL 2000 server
> using deskeeper 2007? Do I need to stop the services or anything else?
>
> Thanks,
>
Hi
If you are using diskeeper as a service then you should be ok, I am not
sure what stand alone application does, but if it is the same windows
defragmenter you will need to make sure the database is not in use i.e SQL
Server is stopped of the database is detached.
John|||IIRC, Diskeeper claims that there server product will defrag sql database
files while sql is still running. I could be misremembering this. I do
have several clients that have done that without any corruptions.
Having said that - stop your sql server. Best not to take the chance, IMHO.
--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net
"Dooma" <nowhere@.noway.com> wrote in message
news:OW1mw8lnIHA.980@.TK2MSFTNGP06.phx.gbl...
> Is there anything I need to be aware of when I defrag my SQL 2000 server
> using deskeeper 2007? Do I need to stop the services or anything else?
>
> Thanks,
>
>|||Do you really need to defrag your filesystem?
Linchi
"Dooma" wrote:
> Is there anything I need to be aware of when I defrag my SQL 2000 server
> using deskeeper 2007? Do I need to stop the services or anything else?
>
> Thanks,
>
>|||Not sure about this poster's need, but I have certainly had client's that
needed to defrag their file system. 300K+ file fragments (which I have seen
at a client) in their database file directory WILL affect performance! :-)
--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
news:6A544A98-8CCE-433F-85FE-3718DCD793AE@.microsoft.com...
> Do you really need to defrag your filesystem?
> Linchi
> "Dooma" wrote:
>> Is there anything I need to be aware of when I defrag my SQL 2000 server
>> using deskeeper 2007? Do I need to stop the services or anything else?
>>
>> Thanks,
>>
>>|||"TheSQLGuru" <kgboles@.earthlink.net> wrote in message
news:8c-dnQ1nWOUmsZXVnZ2dnUVZ_oqhnZ2d@.earthlink.com...
> Not sure about this poster's need, but I have certainly had client's that
> needed to defrag their file system. 300K+ file fragments (which I have
> seen at a client) in their database file directory WILL affect
> performance! :-)
> --
> Kevin G. Boles
> Indicium Resources, Inc.
> SQL Server MVP
> kgboles a earthlink dt net
>
> "Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
> news:6A544A98-8CCE-433F-85FE-3718DCD793AE@.microsoft.com...
>> Do you really need to defrag your filesystem?
>> Linchi
>> "Dooma" wrote:
>> Is there anything I need to be aware of when I defrag my SQL 2000 server
>> using deskeeper 2007? Do I need to stop the services or anything else?
>>
>> Thanks,
Hi
There should usually be a need to defrag the data drives of a system
dedicated to SQL Server unless you have autoshrink on (which is not
recommended), but systems (such as SBS, test or development servers) that
have multiple uses or transient databases can quite often benefit from a
hard disc being defragmented, and I have seen improvements of 20% on some
badly affected systems.
John

Friday, March 9, 2012

definite sequence for install?

Is there a definite sequence for applying Windows 2003 SP 1, Reporting
Services SP 2, and SQL Server SP 4? We are looking to avoid a reinstall of
Reporting Services SP 2. At this time, there are no definite plans for any
of the service packs mentioned. What would be the best sequence of events â'
or doesnâ't it matter?The recommendation is to install SQL Server 2000 SP4 before RS 2000 SP2.
Windows 2003 SP1 is independent.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"mfrom" <mfrom@.discussions.microsoft.com> wrote in message
news:FD475C58-E1B9-4E75-8B0D-8FE04E4DF9C6@.microsoft.com...
> Is there a definite sequence for applying Windows 2003 SP 1, Reporting
> Services SP 2, and SQL Server SP 4? We are looking to avoid a reinstall
> of
> Reporting Services SP 2. At this time, there are no definite plans for
> any
> of the service packs mentioned. What would be the best sequence of
> events -
> or doesn't it matter?

Defining your own Palette in the Chart

The chart contol within Reporting Services only has 7 palette options,
is it possible to define your own palette?You need SP1 to be able to do this.
Bryan Avery wrote:
> The chart contol within Reporting Services only has 7 palette
options,
> is it possible to define your own palette?|||Did you find out how to do it?
I've been wondering about it, didn't find a way to do it.
Kaisa
"Bryan Avery" <b_avery@.yahoo.com> wrote in message
news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> You need SP1 to be able to do this.
> Bryan Avery wrote:
> > The chart contol within Reporting Services only has 7 palette
> options,
> > is it possible to define your own palette?
>|||Once I'd upgraded to SP1 and RTFM it worked:
Here is the extract from the SP1 Release notes
Chart Styles
Chart styles have been enhanced for SP1. Previously, the style of a
chart value element (for example, a bar or pie slice in the chart)
could not be changed in Report Designer. Colors were limited to the
automatic palette for the entire chart; you could not choose the colors
that were assigned to each element. With SP1, the line style and fill
color for an element can be edited using Report Designer. You can also
use expressions to control these styles.
To edit the style of a chart element
1. Using Report Designer, create a chart. For more information about
creating a chart, see "Adding a Chart" in Reporting Services Books
Online.
2. In Layout view, right-click the chart, and then click Properties.
3. On the Data tab, in Values, select the value to edit, and then click
Edit.
NOTE: If there is only one value series in the chart, select [Value].
4. On the Appearance tab, click Series Style.
5. On the Border and Line tab, select the line style, width, and color.
To use an expression, click the Expression (fx) button next to the
desired option.
6. On the Fill tab, select the color, gradient, and gradient end color.
To use an expression, click the Expression (fx) button next to the
desired option.
Note Providing a static value will cause all chart elements for that
value series to display using the same style. For example, selecting
Red for the fill color will cause all bars to become red, overriding
the automatic color assignment from the chart palette. To provide
different styles based on field or other values, use an expression. If
you use an expression for fill color, the chart elements will be white
in Layout view, but will display properly when the report is run.
Note A fill color of Transparent will cause the chart elements to
display using the automatic color assignment from the chart palette.
Kaisa M. Lindahl wrote:
> Did you find out how to do it?
> I've been wondering about it, didn't find a way to do it.
> Kaisa
> "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> > You need SP1 to be able to do this.
> >
> > Bryan Avery wrote:
> > > The chart contol within Reporting Services only has 7 palette
> > options,
> > > is it possible to define your own palette?
> >|||But what about the expression? Something like "= Choose(RowNumber(Nothing or
Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in detail
table rows - does not work in style expressions why? And how to solve the
problem?
"Bryan Avery" wrote:
> Once I'd upgraded to SP1 and RTFM it worked:
> Here is the extract from the SP1 Release notes
> Chart Styles
> Chart styles have been enhanced for SP1. Previously, the style of a
> chart value element (for example, a bar or pie slice in the chart)
> could not be changed in Report Designer. Colors were limited to the
> automatic palette for the entire chart; you could not choose the colors
> that were assigned to each element. With SP1, the line style and fill
> color for an element can be edited using Report Designer. You can also
> use expressions to control these styles.
> To edit the style of a chart element
> 1. Using Report Designer, create a chart. For more information about
> creating a chart, see "Adding a Chart" in Reporting Services Books
> Online.
> 2. In Layout view, right-click the chart, and then click Properties.
> 3. On the Data tab, in Values, select the value to edit, and then click
> Edit.
> NOTE: If there is only one value series in the chart, select [Value].
> 4. On the Appearance tab, click Series Style.
> 5. On the Border and Line tab, select the line style, width, and color.
> To use an expression, click the Expression (fx) button next to the
> desired option.
> 6. On the Fill tab, select the color, gradient, and gradient end color.
> To use an expression, click the Expression (fx) button next to the
> desired option.
> Note Providing a static value will cause all chart elements for that
> value series to display using the same style. For example, selecting
> Red for the fill color will cause all bars to become red, overriding
> the automatic color assignment from the chart palette. To provide
> different styles based on field or other values, use an expression. If
> you use an expression for fill color, the chart elements will be white
> in Layout view, but will display properly when the report is run.
> Note A fill color of Transparent will cause the chart elements to
> display using the automatic color assignment from the chart palette.
> Kaisa M. Lindahl wrote:
> > Did you find out how to do it?
> > I've been wondering about it, didn't find a way to do it.
> >
> > Kaisa
> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> > > You need SP1 to be able to do this.
> > >
> > > Bryan Avery wrote:
> > > > The chart contol within Reporting Services only has 7 palette
> > > options,
> > > > is it possible to define your own palette?
> > >
>|||RowNumber does not work in charts, because a chart is very similar to a
matrix (i.e. you have groupings in two dimensions: columns (categories), and
rows (series)). You cannot use RowNumber in a matrix.
Ok, here is a (trivial) way to use your own custom chart palette.
You would add the following code to report - report properties - code:
Private Shared count As Integer = 0
Private Shared colorPalette As String() = {"Green", "Blue", "Red",
"Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
"#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
Public Function GetColor() As String
Dim c as string = colors(count Mod colors.Length)
count = count + 1
Return c
End Function
On the datapoint, you would then set the BackgroundColor to
=Code.GetColor()
A slightly more advanced way of using your own custom chart palette is to
use the following code:
Private Shared colorPalette As String() = {"Green", "Blue", "Red",
"Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
"#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
Private Shared count As Integer = 0
Private Shared mapping As New System.Collections.Hashtable()
Public Function GetColor(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return osMapping(groupingValue)
End If
Dim c As String = colorPalette(count Mod colorPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
You would then typically use the same expression as argument for
GetColor(...) as you would use on the category grouping expression (assuming
your expression evaluates to a string). As you can see in the code above,
the hash table will store color mappings and look up existing color
mappings. If you have a new group, it will add a new color mapping.
Robert M. Bruckner
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
> But what about the expression? Something like "= Choose(RowNumber(Nothing
> or
> Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
> detail
> table rows - does not work in style expressions why? And how to solve the
> problem?
> "Bryan Avery" wrote:
>> Once I'd upgraded to SP1 and RTFM it worked:
>> Here is the extract from the SP1 Release notes
>> Chart Styles
>> Chart styles have been enhanced for SP1. Previously, the style of a
>> chart value element (for example, a bar or pie slice in the chart)
>> could not be changed in Report Designer. Colors were limited to the
>> automatic palette for the entire chart; you could not choose the colors
>> that were assigned to each element. With SP1, the line style and fill
>> color for an element can be edited using Report Designer. You can also
>> use expressions to control these styles.
>> To edit the style of a chart element
>> 1. Using Report Designer, create a chart. For more information about
>> creating a chart, see "Adding a Chart" in Reporting Services Books
>> Online.
>> 2. In Layout view, right-click the chart, and then click Properties.
>> 3. On the Data tab, in Values, select the value to edit, and then click
>> Edit.
>> NOTE: If there is only one value series in the chart, select [Value].
>> 4. On the Appearance tab, click Series Style.
>> 5. On the Border and Line tab, select the line style, width, and color.
>> To use an expression, click the Expression (fx) button next to the
>> desired option.
>> 6. On the Fill tab, select the color, gradient, and gradient end color.
>> To use an expression, click the Expression (fx) button next to the
>> desired option.
>> Note Providing a static value will cause all chart elements for that
>> value series to display using the same style. For example, selecting
>> Red for the fill color will cause all bars to become red, overriding
>> the automatic color assignment from the chart palette. To provide
>> different styles based on field or other values, use an expression. If
>> you use an expression for fill color, the chart elements will be white
>> in Layout view, but will display properly when the report is run.
>> Note A fill color of Transparent will cause the chart elements to
>> display using the automatic color assignment from the chart palette.
>> Kaisa M. Lindahl wrote:
>> > Did you find out how to do it?
>> > I've been wondering about it, didn't find a way to do it.
>> >
>> > Kaisa
>> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
>> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
>> > > You need SP1 to be able to do this.
>> > >
>> > > Bryan Avery wrote:
>> > > > The chart contol within Reporting Services only has 7 palette
>> > > options,
>> > > > is it possible to define your own palette?
>> > >
>>|||Thx! Setting the FillColor to Code.GetColor() works!
"Robert Bruckner [MSFT]" wrote:
> RowNumber does not work in charts, because a chart is very similar to a
> matrix (i.e. you have groupings in two dimensions: columns (categories), and
> rows (series)). You cannot use RowNumber in a matrix.
>
> Ok, here is a (trivial) way to use your own custom chart palette.
> You would add the following code to report - report properties - code:
> Private Shared count As Integer = 0
> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> Public Function GetColor() As String
> Dim c as string = colors(count Mod colors.Length)
> count = count + 1
> Return c
> End Function
> On the datapoint, you would then set the BackgroundColor to
> =Code.GetColor()
>
> A slightly more advanced way of using your own custom chart palette is to
> use the following code:
> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> Private Shared count As Integer = 0
> Private Shared mapping As New System.Collections.Hashtable()
> Public Function GetColor(ByVal groupingValue As String) As String
> If mapping.ContainsKey(groupingValue) Then
> Return osMapping(groupingValue)
> End If
> Dim c As String = colorPalette(count Mod colorPalette.Length)
> count = count + 1
> mapping.Add(groupingValue, c)
> Return c
> End Function
> You would then typically use the same expression as argument for
> GetColor(...) as you would use on the category grouping expression (assuming
> your expression evaluates to a string). As you can see in the code above,
> the hash table will store color mappings and look up existing color
> mappings. If you have a new group, it will add a new color mapping.
>
> --
> Robert M. Bruckner
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
> > But what about the expression? Something like "= Choose(RowNumber(Nothing
> > or
> > Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
> > detail
> > table rows - does not work in style expressions why? And how to solve the
> > problem?
> >
> > "Bryan Avery" wrote:
> >
> >> Once I'd upgraded to SP1 and RTFM it worked:
> >>
> >> Here is the extract from the SP1 Release notes
> >>
> >> Chart Styles
> >> Chart styles have been enhanced for SP1. Previously, the style of a
> >> chart value element (for example, a bar or pie slice in the chart)
> >> could not be changed in Report Designer. Colors were limited to the
> >> automatic palette for the entire chart; you could not choose the colors
> >> that were assigned to each element. With SP1, the line style and fill
> >> color for an element can be edited using Report Designer. You can also
> >> use expressions to control these styles.
> >>
> >> To edit the style of a chart element
> >>
> >> 1. Using Report Designer, create a chart. For more information about
> >> creating a chart, see "Adding a Chart" in Reporting Services Books
> >> Online.
> >>
> >> 2. In Layout view, right-click the chart, and then click Properties.
> >>
> >> 3. On the Data tab, in Values, select the value to edit, and then click
> >> Edit.
> >>
> >> NOTE: If there is only one value series in the chart, select [Value].
> >> 4. On the Appearance tab, click Series Style.
> >>
> >> 5. On the Border and Line tab, select the line style, width, and color.
> >> To use an expression, click the Expression (fx) button next to the
> >> desired option.
> >>
> >> 6. On the Fill tab, select the color, gradient, and gradient end color.
> >> To use an expression, click the Expression (fx) button next to the
> >> desired option.
> >>
> >> Note Providing a static value will cause all chart elements for that
> >> value series to display using the same style. For example, selecting
> >> Red for the fill color will cause all bars to become red, overriding
> >> the automatic color assignment from the chart palette. To provide
> >> different styles based on field or other values, use an expression. If
> >> you use an expression for fill color, the chart elements will be white
> >> in Layout view, but will display properly when the report is run.
> >> Note A fill color of Transparent will cause the chart elements to
> >> display using the automatic color assignment from the chart palette.
> >> Kaisa M. Lindahl wrote:
> >> > Did you find out how to do it?
> >> > I've been wondering about it, didn't find a way to do it.
> >> >
> >> > Kaisa
> >> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> >> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> >> > > You need SP1 to be able to do this.
> >> > >
> >> > > Bryan Avery wrote:
> >> > > > The chart contol within Reporting Services only has 7 palette
> >> > > options,
> >> > > > is it possible to define your own palette?
> >> > >
> >>
> >>
>
>|||... It works! But now I want to reuse the colorPalette-Array. So I have to
call a simple sub
Public Sub Reset() count = 0 End Function
How to call this Function in the layout section?
"Robert Bruckner [MSFT]" wrote:
> RowNumber does not work in charts, because a chart is very similar to a
> matrix (i.e. you have groupings in two dimensions: columns (categories), and
> rows (series)). You cannot use RowNumber in a matrix.
>
> Ok, here is a (trivial) way to use your own custom chart palette.
> You would add the following code to report - report properties - code:
> Private Shared count As Integer = 0
> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> Public Function GetColor() As String
> Dim c as string = colors(count Mod colors.Length)
> count = count + 1
> Return c
> End Function
> On the datapoint, you would then set the BackgroundColor to
> =Code.GetColor()
>
> A slightly more advanced way of using your own custom chart palette is to
> use the following code:
> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> Private Shared count As Integer = 0
> Private Shared mapping As New System.Collections.Hashtable()
> Public Function GetColor(ByVal groupingValue As String) As String
> If mapping.ContainsKey(groupingValue) Then
> Return osMapping(groupingValue)
> End If
> Dim c As String = colorPalette(count Mod colorPalette.Length)
> count = count + 1
> mapping.Add(groupingValue, c)
> Return c
> End Function
> You would then typically use the same expression as argument for
> GetColor(...) as you would use on the category grouping expression (assuming
> your expression evaluates to a string). As you can see in the code above,
> the hash table will store color mappings and look up existing color
> mappings. If you have a new group, it will add a new color mapping.
>
> --
> Robert M. Bruckner
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
> > But what about the expression? Something like "= Choose(RowNumber(Nothing
> > or
> > Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
> > detail
> > table rows - does not work in style expressions why? And how to solve the
> > problem?
> >
> > "Bryan Avery" wrote:
> >
> >> Once I'd upgraded to SP1 and RTFM it worked:
> >>
> >> Here is the extract from the SP1 Release notes
> >>
> >> Chart Styles
> >> Chart styles have been enhanced for SP1. Previously, the style of a
> >> chart value element (for example, a bar or pie slice in the chart)
> >> could not be changed in Report Designer. Colors were limited to the
> >> automatic palette for the entire chart; you could not choose the colors
> >> that were assigned to each element. With SP1, the line style and fill
> >> color for an element can be edited using Report Designer. You can also
> >> use expressions to control these styles.
> >>
> >> To edit the style of a chart element
> >>
> >> 1. Using Report Designer, create a chart. For more information about
> >> creating a chart, see "Adding a Chart" in Reporting Services Books
> >> Online.
> >>
> >> 2. In Layout view, right-click the chart, and then click Properties.
> >>
> >> 3. On the Data tab, in Values, select the value to edit, and then click
> >> Edit.
> >>
> >> NOTE: If there is only one value series in the chart, select [Value].
> >> 4. On the Appearance tab, click Series Style.
> >>
> >> 5. On the Border and Line tab, select the line style, width, and color.
> >> To use an expression, click the Expression (fx) button next to the
> >> desired option.
> >>
> >> 6. On the Fill tab, select the color, gradient, and gradient end color.
> >> To use an expression, click the Expression (fx) button next to the
> >> desired option.
> >>
> >> Note Providing a static value will cause all chart elements for that
> >> value series to display using the same style. For example, selecting
> >> Red for the fill color will cause all bars to become red, overriding
> >> the automatic color assignment from the chart palette. To provide
> >> different styles based on field or other values, use an expression. If
> >> you use an expression for fill color, the chart elements will be white
> >> in Layout view, but will display properly when the report is run.
> >> Note A fill color of Transparent will cause the chart elements to
> >> display using the automatic color assignment from the chart palette.
> >> Kaisa M. Lindahl wrote:
> >> > Did you find out how to do it?
> >> > I've been wondering about it, didn't find a way to do it.
> >> >
> >> > Kaisa
> >> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> >> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> >> > > You need SP1 to be able to do this.
> >> > >
> >> > > Bryan Avery wrote:
> >> > > > The chart contol within Reporting Services only has 7 palette
> >> > > options,
> >> > > > is it possible to define your own palette?
> >> > >
> >>
> >>
>
>|||If you don't use the chart title, x-axis title, or y-axis title you could
invoke a function there to reset the palette.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
news:FBF93B34-3367-4E16-9F45-982E1B7112C4@.microsoft.com...
> ... It works! But now I want to reuse the colorPalette-Array. So I have to
> call a simple sub
> Public Sub Reset() count = 0 End Function
> How to call this Function in the layout section?
>
> "Robert Bruckner [MSFT]" wrote:
>> RowNumber does not work in charts, because a chart is very similar to a
>> matrix (i.e. you have groupings in two dimensions: columns (categories),
>> and
>> rows (series)). You cannot use RowNumber in a matrix.
>>
>> Ok, here is a (trivial) way to use your own custom chart palette.
>> You would add the following code to report - report properties - code:
>> Private Shared count As Integer = 0
>> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
>> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
>> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
>> Public Function GetColor() As String
>> Dim c as string = colors(count Mod colors.Length)
>> count = count + 1
>> Return c
>> End Function
>> On the datapoint, you would then set the BackgroundColor to
>> =Code.GetColor()
>>
>> A slightly more advanced way of using your own custom chart palette is to
>> use the following code:
>> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
>> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
>> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
>> Private Shared count As Integer = 0
>> Private Shared mapping As New System.Collections.Hashtable()
>> Public Function GetColor(ByVal groupingValue As String) As String
>> If mapping.ContainsKey(groupingValue) Then
>> Return osMapping(groupingValue)
>> End If
>> Dim c As String = colorPalette(count Mod colorPalette.Length)
>> count = count + 1
>> mapping.Add(groupingValue, c)
>> Return c
>> End Function
>> You would then typically use the same expression as argument for
>> GetColor(...) as you would use on the category grouping expression
>> (assuming
>> your expression evaluates to a string). As you can see in the code above,
>> the hash table will store color mappings and look up existing color
>> mappings. If you have a new group, it will add a new color mapping.
>>
>> --
>> Robert M. Bruckner
>> Microsoft SQL Server Reporting Services
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
>> news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
>> > But what about the expression? Something like "=>> > Choose(RowNumber(Nothing
>> > or
>> > Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
>> > detail
>> > table rows - does not work in style expressions why? And how to solve
>> > the
>> > problem?
>> >
>> > "Bryan Avery" wrote:
>> >
>> >> Once I'd upgraded to SP1 and RTFM it worked:
>> >>
>> >> Here is the extract from the SP1 Release notes
>> >>
>> >> Chart Styles
>> >> Chart styles have been enhanced for SP1. Previously, the style of a
>> >> chart value element (for example, a bar or pie slice in the chart)
>> >> could not be changed in Report Designer. Colors were limited to the
>> >> automatic palette for the entire chart; you could not choose the
>> >> colors
>> >> that were assigned to each element. With SP1, the line style and fill
>> >> color for an element can be edited using Report Designer. You can also
>> >> use expressions to control these styles.
>> >>
>> >> To edit the style of a chart element
>> >>
>> >> 1. Using Report Designer, create a chart. For more information about
>> >> creating a chart, see "Adding a Chart" in Reporting Services Books
>> >> Online.
>> >>
>> >> 2. In Layout view, right-click the chart, and then click Properties.
>> >>
>> >> 3. On the Data tab, in Values, select the value to edit, and then
>> >> click
>> >> Edit.
>> >>
>> >> NOTE: If there is only one value series in the chart, select [Value].
>> >> 4. On the Appearance tab, click Series Style.
>> >>
>> >> 5. On the Border and Line tab, select the line style, width, and
>> >> color.
>> >> To use an expression, click the Expression (fx) button next to the
>> >> desired option.
>> >>
>> >> 6. On the Fill tab, select the color, gradient, and gradient end
>> >> color.
>> >> To use an expression, click the Expression (fx) button next to the
>> >> desired option.
>> >>
>> >> Note Providing a static value will cause all chart elements for that
>> >> value series to display using the same style. For example, selecting
>> >> Red for the fill color will cause all bars to become red, overriding
>> >> the automatic color assignment from the chart palette. To provide
>> >> different styles based on field or other values, use an expression. If
>> >> you use an expression for fill color, the chart elements will be white
>> >> in Layout view, but will display properly when the report is run.
>> >> Note A fill color of Transparent will cause the chart elements to
>> >> display using the automatic color assignment from the chart palette.
>> >> Kaisa M. Lindahl wrote:
>> >> > Did you find out how to do it?
>> >> > I've been wondering about it, didn't find a way to do it.
>> >> >
>> >> > Kaisa
>> >> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
>> >> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
>> >> > > You need SP1 to be able to do this.
>> >> > >
>> >> > > Bryan Avery wrote:
>> >> > > > The chart contol within Reporting Services only has 7 palette
>> >> > > options,
>> >> > > > is it possible to define your own palette?
>> >> > >
>> >>
>> >>
>>|||I use the chart type "pie chart" so I cannot use x-title or y-title. Is there
an alternative? (Besides using the chart title)
And: How can I call Subs (instead of functions)?
"Robert Bruckner [MSFT]" wrote:
> If you don't use the chart title, x-axis title, or y-axis title you could
> invoke a function there to reset the palette.
>
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> news:FBF93B34-3367-4E16-9F45-982E1B7112C4@.microsoft.com...
> > ... It works! But now I want to reuse the colorPalette-Array. So I have to
> > call a simple sub
> > Public Sub Reset() count = 0 End Function
> > How to call this Function in the layout section?
> >
> >
> >
> > "Robert Bruckner [MSFT]" wrote:
> >
> >> RowNumber does not work in charts, because a chart is very similar to a
> >> matrix (i.e. you have groupings in two dimensions: columns (categories),
> >> and
> >> rows (series)). You cannot use RowNumber in a matrix.
> >>
> >>
> >> Ok, here is a (trivial) way to use your own custom chart palette.
> >> You would add the following code to report - report properties - code:
> >>
> >> Private Shared count As Integer = 0
> >> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> >> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> >> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> >> Public Function GetColor() As String
> >> Dim c as string = colors(count Mod colors.Length)
> >> count = count + 1
> >> Return c
> >> End Function
> >>
> >> On the datapoint, you would then set the BackgroundColor to
> >> =Code.GetColor()
> >>
> >>
> >> A slightly more advanced way of using your own custom chart palette is to
> >> use the following code:
> >>
> >> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> >> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> >> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> >> Private Shared count As Integer = 0
> >> Private Shared mapping As New System.Collections.Hashtable()
> >> Public Function GetColor(ByVal groupingValue As String) As String
> >> If mapping.ContainsKey(groupingValue) Then
> >> Return osMapping(groupingValue)
> >> End If
> >> Dim c As String = colorPalette(count Mod colorPalette.Length)
> >> count = count + 1
> >> mapping.Add(groupingValue, c)
> >> Return c
> >> End Function
> >>
> >> You would then typically use the same expression as argument for
> >> GetColor(...) as you would use on the category grouping expression
> >> (assuming
> >> your expression evaluates to a string). As you can see in the code above,
> >> the hash table will store color mappings and look up existing color
> >> mappings. If you have a new group, it will add a new color mapping.
> >>
> >>
> >> --
> >> Robert M. Bruckner
> >> Microsoft SQL Server Reporting Services
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >>
> >>
> >> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> >> news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
> >> > But what about the expression? Something like "=> >> > Choose(RowNumber(Nothing
> >> > or
> >> > Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
> >> > detail
> >> > table rows - does not work in style expressions why? And how to solve
> >> > the
> >> > problem?
> >> >
> >> > "Bryan Avery" wrote:
> >> >
> >> >> Once I'd upgraded to SP1 and RTFM it worked:
> >> >>
> >> >> Here is the extract from the SP1 Release notes
> >> >>
> >> >> Chart Styles
> >> >> Chart styles have been enhanced for SP1. Previously, the style of a
> >> >> chart value element (for example, a bar or pie slice in the chart)
> >> >> could not be changed in Report Designer. Colors were limited to the
> >> >> automatic palette for the entire chart; you could not choose the
> >> >> colors
> >> >> that were assigned to each element. With SP1, the line style and fill
> >> >> color for an element can be edited using Report Designer. You can also
> >> >> use expressions to control these styles.
> >> >>
> >> >> To edit the style of a chart element
> >> >>
> >> >> 1. Using Report Designer, create a chart. For more information about
> >> >> creating a chart, see "Adding a Chart" in Reporting Services Books
> >> >> Online.
> >> >>
> >> >> 2. In Layout view, right-click the chart, and then click Properties.
> >> >>
> >> >> 3. On the Data tab, in Values, select the value to edit, and then
> >> >> click
> >> >> Edit.
> >> >>
> >> >> NOTE: If there is only one value series in the chart, select [Value].
> >> >> 4. On the Appearance tab, click Series Style.
> >> >>
> >> >> 5. On the Border and Line tab, select the line style, width, and
> >> >> color.
> >> >> To use an expression, click the Expression (fx) button next to the
> >> >> desired option.
> >> >>
> >> >> 6. On the Fill tab, select the color, gradient, and gradient end
> >> >> color.
> >> >> To use an expression, click the Expression (fx) button next to the
> >> >> desired option.
> >> >>
> >> >> Note Providing a static value will cause all chart elements for that
> >> >> value series to display using the same style. For example, selecting
> >> >> Red for the fill color will cause all bars to become red, overriding
> >> >> the automatic color assignment from the chart palette. To provide
> >> >> different styles based on field or other values, use an expression. If
> >> >> you use an expression for fill color, the chart elements will be white
> >> >> in Layout view, but will display properly when the report is run.
> >> >> Note A fill color of Transparent will cause the chart elements to
> >> >> display using the automatic color assignment from the chart palette.
> >> >> Kaisa M. Lindahl wrote:
> >> >> > Did you find out how to do it?
> >> >> > I've been wondering about it, didn't find a way to do it.
> >> >> >
> >> >> > Kaisa
> >> >> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> >> >> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> >> >> > > You need SP1 to be able to do this.
> >> >> > >
> >> >> > > Bryan Avery wrote:
> >> >> > > > The chart contol within Reporting Services only has 7 palette
> >> >> > > options,
> >> >> > > > is it possible to define your own palette?
> >> >> > >
> >> >>
> >> >>
> >>
> >>
> >>
>
>|||Hi,
I tried the attached code and I received this error: There is an error on
line 1 of custom code: [BC30201] Expression expected.
Can someone tell me what I'm doing wrong?
Thanks!
"Hawkeye" wrote:
> I use the chart type "pie chart" so I cannot use x-title or y-title. Is there
> an alternative? (Besides using the chart title)
> And: How can I call Subs (instead of functions)?
>
>
> "Robert Bruckner [MSFT]" wrote:
> > If you don't use the chart title, x-axis title, or y-axis title you could
> > invoke a function there to reset the palette.
> >
> >
> > -- Robert
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> >
> > "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> > news:FBF93B34-3367-4E16-9F45-982E1B7112C4@.microsoft.com...
> > > ... It works! But now I want to reuse the colorPalette-Array. So I have to
> > > call a simple sub
> > > Public Sub Reset() count = 0 End Function
> > > How to call this Function in the layout section?
> > >
> > >
> > >
> > > "Robert Bruckner [MSFT]" wrote:
> > >
> > >> RowNumber does not work in charts, because a chart is very similar to a
> > >> matrix (i.e. you have groupings in two dimensions: columns (categories),
> > >> and
> > >> rows (series)). You cannot use RowNumber in a matrix.
> > >>
> > >>
> > >> Ok, here is a (trivial) way to use your own custom chart palette.
> > >> You would add the following code to report - report properties - code:
> > >>
> > >> Private Shared count As Integer = 0
> > >> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> > >> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> > >> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> > >> Public Function GetColor() As String
> > >> Dim c as string = colors(count Mod colors.Length)
> > >> count = count + 1
> > >> Return c
> > >> End Function
> > >>
> > >> On the datapoint, you would then set the BackgroundColor to
> > >> =Code.GetColor()
> > >>
> > >>
> > >> A slightly more advanced way of using your own custom chart palette is to
> > >> use the following code:
> > >>
> > >> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> > >> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> > >> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> > >> Private Shared count As Integer = 0
> > >> Private Shared mapping As New System.Collections.Hashtable()
> > >> Public Function GetColor(ByVal groupingValue As String) As String
> > >> If mapping.ContainsKey(groupingValue) Then
> > >> Return osMapping(groupingValue)
> > >> End If
> > >> Dim c As String = colorPalette(count Mod colorPalette.Length)
> > >> count = count + 1
> > >> mapping.Add(groupingValue, c)
> > >> Return c
> > >> End Function
> > >>
> > >> You would then typically use the same expression as argument for
> > >> GetColor(...) as you would use on the category grouping expression
> > >> (assuming
> > >> your expression evaluates to a string). As you can see in the code above,
> > >> the hash table will store color mappings and look up existing color
> > >> mappings. If you have a new group, it will add a new color mapping.
> > >>
> > >>
> > >> --
> > >> Robert M. Bruckner
> > >> Microsoft SQL Server Reporting Services
> > >> This posting is provided "AS IS" with no warranties, and confers no
> > >> rights.
> > >>
> > >>
> > >>
> > >>
> > >> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> > >> news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
> > >> > But what about the expression? Something like "=> > >> > Choose(RowNumber(Nothing
> > >> > or
> > >> > Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
> > >> > detail
> > >> > table rows - does not work in style expressions why? And how to solve
> > >> > the
> > >> > problem?
> > >> >
> > >> > "Bryan Avery" wrote:
> > >> >
> > >> >> Once I'd upgraded to SP1 and RTFM it worked:
> > >> >>
> > >> >> Here is the extract from the SP1 Release notes
> > >> >>
> > >> >> Chart Styles
> > >> >> Chart styles have been enhanced for SP1. Previously, the style of a
> > >> >> chart value element (for example, a bar or pie slice in the chart)
> > >> >> could not be changed in Report Designer. Colors were limited to the
> > >> >> automatic palette for the entire chart; you could not choose the
> > >> >> colors
> > >> >> that were assigned to each element. With SP1, the line style and fill
> > >> >> color for an element can be edited using Report Designer. You can also
> > >> >> use expressions to control these styles.
> > >> >>
> > >> >> To edit the style of a chart element
> > >> >>
> > >> >> 1. Using Report Designer, create a chart. For more information about
> > >> >> creating a chart, see "Adding a Chart" in Reporting Services Books
> > >> >> Online.
> > >> >>
> > >> >> 2. In Layout view, right-click the chart, and then click Properties.
> > >> >>
> > >> >> 3. On the Data tab, in Values, select the value to edit, and then
> > >> >> click
> > >> >> Edit.
> > >> >>
> > >> >> NOTE: If there is only one value series in the chart, select [Value].
> > >> >> 4. On the Appearance tab, click Series Style.
> > >> >>
> > >> >> 5. On the Border and Line tab, select the line style, width, and
> > >> >> color.
> > >> >> To use an expression, click the Expression (fx) button next to the
> > >> >> desired option.
> > >> >>
> > >> >> 6. On the Fill tab, select the color, gradient, and gradient end
> > >> >> color.
> > >> >> To use an expression, click the Expression (fx) button next to the
> > >> >> desired option.
> > >> >>
> > >> >> Note Providing a static value will cause all chart elements for that
> > >> >> value series to display using the same style. For example, selecting
> > >> >> Red for the fill color will cause all bars to become red, overriding
> > >> >> the automatic color assignment from the chart palette. To provide
> > >> >> different styles based on field or other values, use an expression. If
> > >> >> you use an expression for fill color, the chart elements will be white
> > >> >> in Layout view, but will display properly when the report is run.
> > >> >> Note A fill color of Transparent will cause the chart elements to
> > >> >> display using the automatic color assignment from the chart palette.
> > >> >> Kaisa M. Lindahl wrote:
> > >> >> > Did you find out how to do it?
> > >> >> > I've been wondering about it, didn't find a way to do it.
> > >> >> >
> > >> >> > Kaisa
> > >> >> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> > >> >> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> > >> >> > > You need SP1 to be able to do this.
> > >> >> > >
> > >> >> > > Bryan Avery wrote:
> > >> >> > > > The chart contol within Reporting Services only has 7 palette
> > >> >> > > options,
> > >> >> > > > is it possible to define your own palette?
> > >> >> > >
> > >> >>
> > >> >>
> > >>
> > >>
> > >>
> >
> >
> >|||>I use the chart type "pie chart" so I cannot use x-title or y-title. Is
>there an alternative? (Besides using the chart title)
You could, for instance, call the expression in the following place:
* open chart properties dialog
* click on the "chart area style" button in the general tab
* e.g. for the Style property use an expression like =Code.ResetColor
* Add the following function on the custom code window:
Public Function ResetColor() As String
count = 0
Return "None"
End Function
> And: How can I call Subs (instead of functions)?
You would convert the sub into a function which returns a string
representing the value you would want to set anyway on that property. But in
addition you would reset the count. See example above.
Alternatively, you could define multiple color palettes and multiple
GetColor functions. In that case there would be no need to reset because you
don't share the palette in multiple charts (or data regions in general).
BTW: my advanced sample in my previous posting had a minor typo which is
fixed below.
Private Shared colorPalette As String() = {"Green", "Blue", "Red", "Orange",
"Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B", "#352F26",
"#F1E7D6", "#E16C56", "#CFBA9B"}
Private Shared count As Integer = 0
Private Shared mapping As New System.Collections.Hashtable()
Public Function GetColor(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return mapping(groupingValue)
End If
Dim c As String = colorPalette(count Mod colorPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
At the bottom I added a fully functional RDL file which shows the usage of
custom palettes.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
=====================================================
<?xml version="1.0" encoding="utf-8"?>
<Report
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition"
xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<RightMargin>1in</RightMargin>
<Author>Robert M. Bruckner</Author>
<Body>
<ReportItems>
<Table Name="table1">
<Height>0.5in</Height>
<ZIndex>1</ZIndex>
<Style />
<Header>
<TableRows>
<TableRow>
<Height>0.25in</Height>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox1">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>3</ZIndex>
<rd:DefaultName>textbox1</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox2">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
<FontWeight>700</FontWeight>
</Style>
<ZIndex>2</ZIndex>
<rd:DefaultName>textbox2</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>Legend</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
</TableRow>
</TableRows>
</Header>
<DataSetName>DataSet1</DataSetName>
<Top>0.125in</Top>
<Width>2in</Width>
<TableGroups>
<TableGroup>
<Header>
<TableRows>
<TableRow>
<Height>0.25in</Height>
<TableCells>
<TableCell>
<ReportItems>
<Rectangle Name="rectangle1">
<ZIndex>1</ZIndex>
<Style>
<BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
</Style>
</Rectangle>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="CategoryName">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<rd:DefaultName>CategoryName</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>=Fields!CategoryName.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
</TableRow>
</TableRows>
</Header>
<Grouping Name="table1_Group1">
<GroupExpressions>
<GroupExpression>=Fields!CategoryName.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Sorting>
<SortBy>
<SortExpression>=Fields!CategoryName.Value</SortExpression>
<Direction>Ascending</Direction>
</SortBy>
</Sorting>
</TableGroup>
</TableGroups>
<Left>3.25in</Left>
<TableColumns>
<TableColumn>
<Width>0.25in</Width>
</TableColumn>
<TableColumn>
<Width>1.75in</Width>
</TableColumn>
</TableColumns>
</Table>
<Chart Name="chart1">
<ThreeDProperties>
<Rotation>30</Rotation>
<Inclination>30</Inclination>
<Shading>Simple</Shading>
<WallThickness>50</WallThickness>
</ThreeDProperties>
<Style>
<BackgroundColor>White</BackgroundColor>
</Style>
<Legend>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
<Position>BottomCenter</Position>
<Layout>Table</Layout>
</Legend>
<Palette>Default</Palette>
<ChartData>
<ChartSeries>
<DataPoints>
<DataPoint>
<DataValues>
<DataValue>
<Value>=Sum(Fields!UnitsInStock.Value)</Value>
</DataValue>
</DataValues>
<DataLabel />
<Style>
<BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
</Style>
<Marker>
<Size>6pt</Size>
</Marker>
</DataPoint>
</DataPoints>
</ChartSeries>
</ChartData>
<CategoryAxis>
<Axis>
<Title />
<MajorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<Min>0</Min>
</Axis>
</CategoryAxis>
<DataSetName>DataSet1</DataSetName>
<PointWidth>0</PointWidth>
<Type>Bar</Type>
<Top>0.25in</Top>
<Title />
<Width>3in</Width>
<Height>2.5in</Height>
<SeriesGroupings>
<SeriesGrouping>
<DynamicSeries>
<Grouping Name="chart1_SeriesGroup1">
<GroupExpressions>
<GroupExpression>=Fields!CategoryName.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Sorting>
<SortBy>
<SortExpression>=Fields!CategoryName.Value</SortExpression>
<Direction>Ascending</Direction>
</SortBy>
</Sorting>
<Label>=Fields!CategoryName.Value</Label>
</DynamicSeries>
</SeriesGrouping>
</SeriesGroupings>
<Subtype>Plain</Subtype>
<PlotArea>
<Style>
<BackgroundColor>LightGrey</BackgroundColor>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</PlotArea>
<Left>0.125in</Left>
<ValueAxis>
<Axis>
<Title />
<MajorGridLines>
<ShowGridLines>true</ShowGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<MajorTickMarks>Outside</MajorTickMarks>
<Min>0</Min>
<Margin>true</Margin>
<Visible>true</Visible>
<Scalar>true</Scalar>
</Axis>
</ValueAxis>
</Chart>
</ReportItems>
<Style />
<Height>3.25in</Height>
</Body>
<TopMargin>1in</TopMargin>
<DataSources>
<DataSource Name="Northwind">
<rd:DataSourceID>f646058b-4784-494d-a09d-27fde13a5679</rd:DataSourceID>
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>data source=(local);initial
catalog=Northwind</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
</DataSource>
</DataSources>
<Code> Private Shared colorPalette As String() = {"Green", "Blue",
"Red", "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
"#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
Private Shared count As Integer = 0
Private Shared mapping As New System.Collections.Hashtable()
Public Function GetColor(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return mapping(groupingValue)
End If
Dim c As String = colorPalette(count Mod colorPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
</Code>
<Width>6.5in</Width>
<DataSets>
<DataSet Name="DataSet1">
<Fields>
<Field Name="ProductID">
<DataField>ProductID</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="ProductName">
<DataField>ProductName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="SupplierID">
<DataField>SupplierID</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="CategoryID">
<DataField>CategoryID</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="QuantityPerUnit">
<DataField>QuantityPerUnit</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="UnitPrice">
<DataField>UnitPrice</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
<Field Name="UnitsInStock">
<DataField>UnitsInStock</DataField>
<rd:TypeName>System.Int16</rd:TypeName>
</Field>
<Field Name="UnitsOnOrder">
<DataField>UnitsOnOrder</DataField>
<rd:TypeName>System.Int16</rd:TypeName>
</Field>
<Field Name="ReorderLevel">
<DataField>ReorderLevel</DataField>
<rd:TypeName>System.Int16</rd:TypeName>
</Field>
<Field Name="Discontinued">
<DataField>Discontinued</DataField>
<rd:TypeName>System.Boolean</rd:TypeName>
</Field>
<Field Name="CategoryName">
<DataField>CategoryName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Country">
<DataField>Country</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>Northwind</DataSourceName>
<CommandText>SELECT Products.*, Categories.CategoryName,
Suppliers.Country
FROM Products INNER JOIN
Categories ON Products.CategoryID =Categories.CategoryID INNER JOIN
Suppliers ON Products.SupplierID =Suppliers.SupplierID</CommandText>
</Query>
</DataSet>
</DataSets>
<LeftMargin>1in</LeftMargin>
<rd:SnapToGrid>true</rd:SnapToGrid>
<rd:DrawGrid>true</rd:DrawGrid>
<rd:ReportID>e5564b0f-4fab-4cf7-9cef-bda726589920</rd:ReportID>
<BottomMargin>1in</BottomMargin>
<Language>en-US</Language>
</Report>|||That works! I couldn't use subs, could I?
What I found interesting is that without reseting the counter, the last
value of the counter resist in memory so that for the next run (!) of the
report the counter is not only not reinit to zero, but also further increased.
Is that the normal behaviour of shared report variables?
"Robert Bruckner [MSFT]" wrote:
> >I use the chart type "pie chart" so I cannot use x-title or y-title. Is
> >there an alternative? (Besides using the chart title)
> You could, for instance, call the expression in the following place:
> * open chart properties dialog
> * click on the "chart area style" button in the general tab
> * e.g. for the Style property use an expression like =Code.ResetColor
> * Add the following function on the custom code window:
> Public Function ResetColor() As String
> count = 0
> Return "None"
> End Function
> > And: How can I call Subs (instead of functions)?
> You would convert the sub into a function which returns a string
> representing the value you would want to set anyway on that property. But in
> addition you would reset the count. See example above.
>
> Alternatively, you could define multiple color palettes and multiple
> GetColor functions. In that case there would be no need to reset because you
> don't share the palette in multiple charts (or data regions in general).
> BTW: my advanced sample in my previous posting had a minor typo which is
> fixed below.
> Private Shared colorPalette As String() = {"Green", "Blue", "Red", "Orange",
> "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B", "#352F26",
> "#F1E7D6", "#E16C56", "#CFBA9B"}
> Private Shared count As Integer = 0
> Private Shared mapping As New System.Collections.Hashtable()
> Public Function GetColor(ByVal groupingValue As String) As String
> If mapping.ContainsKey(groupingValue) Then
> Return mapping(groupingValue)
> End If
> Dim c As String = colorPalette(count Mod colorPalette.Length)
> count = count + 1
> mapping.Add(groupingValue, c)
> Return c
> End Function
>
> At the bottom I added a fully functional RDL file which shows the usage of
> custom palettes.
>
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
> =====================================================> <?xml version="1.0" encoding="utf-8"?>
> <Report
> xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition"
> xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
> <RightMargin>1in</RightMargin>
> <Author>Robert M. Bruckner</Author>
> <Body>
> <ReportItems>
> <Table Name="table1">
> <Height>0.5in</Height>
> <ZIndex>1</ZIndex>
> <Style />
> <Header>
> <TableRows>
> <TableRow>
> <Height>0.25in</Height>
> <TableCells>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox1">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>3</ZIndex>
> <rd:DefaultName>textbox1</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value />
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox2">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> <FontWeight>700</FontWeight>
> </Style>
> <ZIndex>2</ZIndex>
> <rd:DefaultName>textbox2</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>Legend</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> </TableCells>
> </TableRow>
> </TableRows>
> </Header>
> <DataSetName>DataSet1</DataSetName>
> <Top>0.125in</Top>
> <Width>2in</Width>
> <TableGroups>
> <TableGroup>
> <Header>
> <TableRows>
> <TableRow>
> <Height>0.25in</Height>
> <TableCells>
> <TableCell>
> <ReportItems>
> <Rectangle Name="rectangle1">
> <ZIndex>1</ZIndex>
> <Style>
> <BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
> </Style>
> </Rectangle>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="CategoryName">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <rd:DefaultName>CategoryName</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>=Fields!CategoryName.Value</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> </TableCells>
> </TableRow>
> </TableRows>
> </Header>
> <Grouping Name="table1_Group1">
> <GroupExpressions>
> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
> </GroupExpressions>
> </Grouping>
> <Sorting>
> <SortBy>
> <SortExpression>=Fields!CategoryName.Value</SortExpression>
> <Direction>Ascending</Direction>
> </SortBy>
> </Sorting>
> </TableGroup>
> </TableGroups>
> <Left>3.25in</Left>
> <TableColumns>
> <TableColumn>
> <Width>0.25in</Width>
> </TableColumn>
> <TableColumn>
> <Width>1.75in</Width>
> </TableColumn>
> </TableColumns>
> </Table>
> <Chart Name="chart1">
> <ThreeDProperties>
> <Rotation>30</Rotation>
> <Inclination>30</Inclination>
> <Shading>Simple</Shading>
> <WallThickness>50</WallThickness>
> </ThreeDProperties>
> <Style>
> <BackgroundColor>White</BackgroundColor>
> </Style>
> <Legend>
> <Style>
> <BorderStyle>
> <Default>Solid</Default>
> </BorderStyle>
> </Style>
> <Position>BottomCenter</Position>
> <Layout>Table</Layout>
> </Legend>
> <Palette>Default</Palette>
> <ChartData>
> <ChartSeries>
> <DataPoints>
> <DataPoint>
> <DataValues>
> <DataValue>
> <Value>=Sum(Fields!UnitsInStock.Value)</Value>
> </DataValue>
> </DataValues>
> <DataLabel />
> <Style>
> <BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
> </Style>
> <Marker>
> <Size>6pt</Size>
> </Marker>
> </DataPoint>
> </DataPoints>
> </ChartSeries>
> </ChartData>
> <CategoryAxis>
> <Axis>
> <Title />
> <MajorGridLines>
> <Style>
> <BorderStyle>
> <Default>Solid</Default>
> </BorderStyle>
> </Style>
> </MajorGridLines>
> <MinorGridLines>
> <Style>
> <BorderStyle>
> <Default>Solid</Default>
> </BorderStyle>
> </Style>
> </MinorGridLines>
> <Min>0</Min>
> </Axis>
> </CategoryAxis>
> <DataSetName>DataSet1</DataSetName>
> <PointWidth>0</PointWidth>
> <Type>Bar</Type>
> <Top>0.25in</Top>
> <Title />
> <Width>3in</Width>
> <Height>2.5in</Height>
> <SeriesGroupings>
> <SeriesGrouping>
> <DynamicSeries>
> <Grouping Name="chart1_SeriesGroup1">
> <GroupExpressions>
> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
> </GroupExpressions>
> </Grouping>
> <Sorting>
> <SortBy>
> <SortExpression>=Fields!CategoryName.Value</SortExpression>
> <Direction>Ascending</Direction>
> </SortBy>
> </Sorting>
> <Label>=Fields!CategoryName.Value</Label>
> </DynamicSeries>
> </SeriesGrouping>
> </SeriesGroupings>
> <Subtype>Plain</Subtype>
> <PlotArea>
> <Style>
> <BackgroundColor>LightGrey</BackgroundColor>
> <BorderStyle>
> <Default>Solid</Default>
> </BorderStyle>
> </Style>
> </PlotArea>
> <Left>0.125in</Left>
> <ValueAxis>
> <Axis>
> <Title />
> <MajorGridLines>
> <ShowGridLines>true</ShowGridLines>
> <Style>
> <BorderStyle>
> <Default>Solid</Default>
> </BorderStyle>
> </Style>
> </MajorGridLines>
> <MinorGridLines>
> <Style>
> <BorderStyle>
> <Default>Solid</Default>
> </BorderStyle>
> </Style>
> </MinorGridLines>
> <MajorTickMarks>Outside</MajorTickMarks>
> <Min>0</Min>
> <Margin>true</Margin>
> <Visible>true</Visible>
> <Scalar>true</Scalar>
> </Axis>
> </ValueAxis>
> </Chart>
> </ReportItems>
> <Style />
> <Height>3.25in</Height>
> </Body>
> <TopMargin>1in</TopMargin>
> <DataSources>
> <DataSource Name="Northwind">
> <rd:DataSourceID>f646058b-4784-494d-a09d-27fde13a5679</rd:DataSourceID>
> <ConnectionProperties>
> <DataProvider>SQL</DataProvider>
> <ConnectString>data source=(local);initial
> catalog=Northwind</ConnectString>|||Yes, the variables are marked as shared - so they are really shared across
all requests on a server. One way to solve this is to use e.g. a hashtable
storing the counter based on the username (from the Globals collection) to
make sure that different users running the same report at the same time
can't affect each other.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
news:91642910-E126-408B-A2A9-1F5B02BEB7FE@.microsoft.com...
> That works! I couldn't use subs, could I?
> What I found interesting is that without reseting the counter, the last
> value of the counter resist in memory so that for the next run (!) of the
> report the counter is not only not reinit to zero, but also further
> increased.
> Is that the normal behaviour of shared report variables?
>
> "Robert Bruckner [MSFT]" wrote:
>> >I use the chart type "pie chart" so I cannot use x-title or y-title. Is
>> >there an alternative? (Besides using the chart title)
>> You could, for instance, call the expression in the following place:
>> * open chart properties dialog
>> * click on the "chart area style" button in the general tab
>> * e.g. for the Style property use an expression like =Code.ResetColor
>> * Add the following function on the custom code window:
>> Public Function ResetColor() As String
>> count = 0
>> Return "None"
>> End Function
>> > And: How can I call Subs (instead of functions)?
>> You would convert the sub into a function which returns a string
>> representing the value you would want to set anyway on that property. But
>> in
>> addition you would reset the count. See example above.
>>
>> Alternatively, you could define multiple color palettes and multiple
>> GetColor functions. In that case there would be no need to reset because
>> you
>> don't share the palette in multiple charts (or data regions in general).
>> BTW: my advanced sample in my previous posting had a minor typo which is
>> fixed below.
>> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
>> "Orange",
>> "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B", "#352F26",
>> "#F1E7D6", "#E16C56", "#CFBA9B"}
>> Private Shared count As Integer = 0
>> Private Shared mapping As New System.Collections.Hashtable()
>> Public Function GetColor(ByVal groupingValue As String) As String
>> If mapping.ContainsKey(groupingValue) Then
>> Return mapping(groupingValue)
>> End If
>> Dim c As String = colorPalette(count Mod colorPalette.Length)
>> count = count + 1
>> mapping.Add(groupingValue, c)
>> Return c
>> End Function
>>
>> At the bottom I added a fully functional RDL file which shows the usage
>> of
>> custom palettes.
>>
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> =====================================================>> <?xml version="1.0" encoding="utf-8"?>
>> <Report
>> xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition"
>> xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
>> <RightMargin>1in</RightMargin>
>> <Author>Robert M. Bruckner</Author>
>> <Body>
>> <ReportItems>
>> <Table Name="table1">
>> <Height>0.5in</Height>
>> <ZIndex>1</ZIndex>
>> <Style />
>> <Header>
>> <TableRows>
>> <TableRow>
>> <Height>0.25in</Height>
>> <TableCells>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="textbox1">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> </Style>
>> <ZIndex>3</ZIndex>
>> <rd:DefaultName>textbox1</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value />
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="textbox2">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> <FontWeight>700</FontWeight>
>> </Style>
>> <ZIndex>2</ZIndex>
>> <rd:DefaultName>textbox2</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value>Legend</Value>
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> </TableCells>
>> </TableRow>
>> </TableRows>
>> </Header>
>> <DataSetName>DataSet1</DataSetName>
>> <Top>0.125in</Top>
>> <Width>2in</Width>
>> <TableGroups>
>> <TableGroup>
>> <Header>
>> <TableRows>
>> <TableRow>
>> <Height>0.25in</Height>
>> <TableCells>
>> <TableCell>
>> <ReportItems>
>> <Rectangle Name="rectangle1">
>> <ZIndex>1</ZIndex>
>> <Style>
>> <BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
>> </Style>
>> </Rectangle>
>> </ReportItems>
>> </TableCell>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="CategoryName">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> </Style>
>> <rd:DefaultName>CategoryName</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value>=Fields!CategoryName.Value</Value>
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> </TableCells>
>> </TableRow>
>> </TableRows>
>> </Header>
>> <Grouping Name="table1_Group1">
>> <GroupExpressions>
>> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
>> </GroupExpressions>
>> </Grouping>
>> <Sorting>
>> <SortBy>
>> <SortExpression>=Fields!CategoryName.Value</SortExpression>
>> <Direction>Ascending</Direction>
>> </SortBy>
>> </Sorting>
>> </TableGroup>
>> </TableGroups>
>> <Left>3.25in</Left>
>> <TableColumns>
>> <TableColumn>
>> <Width>0.25in</Width>
>> </TableColumn>
>> <TableColumn>
>> <Width>1.75in</Width>
>> </TableColumn>
>> </TableColumns>
>> </Table>
>> <Chart Name="chart1">
>> <ThreeDProperties>
>> <Rotation>30</Rotation>
>> <Inclination>30</Inclination>
>> <Shading>Simple</Shading>
>> <WallThickness>50</WallThickness>
>> </ThreeDProperties>
>> <Style>
>> <BackgroundColor>White</BackgroundColor>
>> </Style>
>> <Legend>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> <Position>BottomCenter</Position>
>> <Layout>Table</Layout>
>> </Legend>
>> <Palette>Default</Palette>
>> <ChartData>
>> <ChartSeries>
>> <DataPoints>
>> <DataPoint>
>> <DataValues>
>> <DataValue>
>> <Value>=Sum(Fields!UnitsInStock.Value)</Value>
>> </DataValue>
>> </DataValues>
>> <DataLabel />
>> <Style>
>> <BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
>> </Style>
>> <Marker>
>> <Size>6pt</Size>
>> </Marker>
>> </DataPoint>
>> </DataPoints>
>> </ChartSeries>
>> </ChartData>
>> <CategoryAxis>
>> <Axis>
>> <Title />
>> <MajorGridLines>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </MajorGridLines>
>> <MinorGridLines>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </MinorGridLines>
>> <Min>0</Min>
>> </Axis>
>> </CategoryAxis>
>> <DataSetName>DataSet1</DataSetName>
>> <PointWidth>0</PointWidth>
>> <Type>Bar</Type>
>> <Top>0.25in</Top>
>> <Title />
>> <Width>3in</Width>
>> <Height>2.5in</Height>
>> <SeriesGroupings>
>> <SeriesGrouping>
>> <DynamicSeries>
>> <Grouping Name="chart1_SeriesGroup1">
>> <GroupExpressions>
>> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
>> </GroupExpressions>
>> </Grouping>
>> <Sorting>
>> <SortBy>
>> <SortExpression>=Fields!CategoryName.Value</SortExpression>
>> <Direction>Ascending</Direction>
>> </SortBy>
>> </Sorting>
>> <Label>=Fields!CategoryName.Value</Label>
>> </DynamicSeries>
>> </SeriesGrouping>
>> </SeriesGroupings>
>> <Subtype>Plain</Subtype>
>> <PlotArea>
>> <Style>
>> <BackgroundColor>LightGrey</BackgroundColor>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </PlotArea>
>> <Left>0.125in</Left>
>> <ValueAxis>
>> <Axis>
>> <Title />
>> <MajorGridLines>
>> <ShowGridLines>true</ShowGridLines>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </MajorGridLines>
>> <MinorGridLines>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </MinorGridLines>
>> <MajorTickMarks>Outside</MajorTickMarks>
>> <Min>0</Min>
>> <Margin>true</Margin>
>> <Visible>true</Visible>
>> <Scalar>true</Scalar>
>> </Axis>
>> </ValueAxis>
>> </Chart>
>> </ReportItems>
>> <Style />
>> <Height>3.25in</Height>
>> </Body>
>> <TopMargin>1in</TopMargin>
>> <DataSources>
>> <DataSource Name="Northwind">
>> <rd:DataSourceID>f646058b-4784-494d-a09d-27fde13a5679</rd:DataSourceID>
>> <ConnectionProperties>
>> <DataProvider>SQL</DataProvider>
>> <ConnectString>data source=(local);initial
>> catalog=Northwind</ConnectString>|||Actually, in this case it would also work without defining the variables as
shared.
i.e.:
Private count As Integer = 0
Private mapping As New System.Collections.Hashtable()
...
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:%23IohCWXXFHA.712@.TK2MSFTNGP14.phx.gbl...
> Yes, the variables are marked as shared - so they are really shared across
> all requests on a server. One way to solve this is to use e.g. a hashtable
> storing the counter based on the username (from the Globals collection) to
> make sure that different users running the same report at the same time
> can't affect each other.
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> news:91642910-E126-408B-A2A9-1F5B02BEB7FE@.microsoft.com...
>> That works! I couldn't use subs, could I?
>> What I found interesting is that without reseting the counter, the last
>> value of the counter resist in memory so that for the next run (!) of the
>> report the counter is not only not reinit to zero, but also further
>> increased.
>> Is that the normal behaviour of shared report variables?
>>
>> "Robert Bruckner [MSFT]" wrote:
>> >I use the chart type "pie chart" so I cannot use x-title or y-title. Is
>> >there an alternative? (Besides using the chart title)
>> You could, for instance, call the expression in the following place:
>> * open chart properties dialog
>> * click on the "chart area style" button in the general tab
>> * e.g. for the Style property use an expression like =Code.ResetColor
>> * Add the following function on the custom code window:
>> Public Function ResetColor() As String
>> count = 0
>> Return "None"
>> End Function
>> > And: How can I call Subs (instead of functions)?
>> You would convert the sub into a function which returns a string
>> representing the value you would want to set anyway on that property.
>> But in
>> addition you would reset the count. See example above.
>>
>> Alternatively, you could define multiple color palettes and multiple
>> GetColor functions. In that case there would be no need to reset because
>> you
>> don't share the palette in multiple charts (or data regions in general).
>> BTW: my advanced sample in my previous posting had a minor typo which is
>> fixed below.
>> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
>> "Orange",
>> "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B", "#352F26",
>> "#F1E7D6", "#E16C56", "#CFBA9B"}
>> Private Shared count As Integer = 0
>> Private Shared mapping As New System.Collections.Hashtable()
>> Public Function GetColor(ByVal groupingValue As String) As String
>> If mapping.ContainsKey(groupingValue) Then
>> Return mapping(groupingValue)
>> End If
>> Dim c As String = colorPalette(count Mod colorPalette.Length)
>> count = count + 1
>> mapping.Add(groupingValue, c)
>> Return c
>> End Function
>>
>> At the bottom I added a fully functional RDL file which shows the usage
>> of
>> custom palettes.
>>
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> =====================================================>> <?xml version="1.0" encoding="utf-8"?>
>> <Report
>> xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition"
>> xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
>> <RightMargin>1in</RightMargin>
>> <Author>Robert M. Bruckner</Author>
>> <Body>
>> <ReportItems>
>> <Table Name="table1">
>> <Height>0.5in</Height>
>> <ZIndex>1</ZIndex>
>> <Style />
>> <Header>
>> <TableRows>
>> <TableRow>
>> <Height>0.25in</Height>
>> <TableCells>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="textbox1">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> </Style>
>> <ZIndex>3</ZIndex>
>> <rd:DefaultName>textbox1</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value />
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="textbox2">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> <FontWeight>700</FontWeight>
>> </Style>
>> <ZIndex>2</ZIndex>
>> <rd:DefaultName>textbox2</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value>Legend</Value>
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> </TableCells>
>> </TableRow>
>> </TableRows>
>> </Header>
>> <DataSetName>DataSet1</DataSetName>
>> <Top>0.125in</Top>
>> <Width>2in</Width>
>> <TableGroups>
>> <TableGroup>
>> <Header>
>> <TableRows>
>> <TableRow>
>> <Height>0.25in</Height>
>> <TableCells>
>> <TableCell>
>> <ReportItems>
>> <Rectangle Name="rectangle1">
>> <ZIndex>1</ZIndex>
>> <Style>
>> <BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
>> </Style>
>> </Rectangle>
>> </ReportItems>
>> </TableCell>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="CategoryName">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> </Style>
>> <rd:DefaultName>CategoryName</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value>=Fields!CategoryName.Value</Value>
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> </TableCells>
>> </TableRow>
>> </TableRows>
>> </Header>
>> <Grouping Name="table1_Group1">
>> <GroupExpressions>
>> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
>> </GroupExpressions>
>> </Grouping>
>> <Sorting>
>> <SortBy>
>> <SortExpression>=Fields!CategoryName.Value</SortExpression>
>> <Direction>Ascending</Direction>
>> </SortBy>
>> </Sorting>
>> </TableGroup>
>> </TableGroups>
>> <Left>3.25in</Left>
>> <TableColumns>
>> <TableColumn>
>> <Width>0.25in</Width>
>> </TableColumn>
>> <TableColumn>
>> <Width>1.75in</Width>
>> </TableColumn>
>> </TableColumns>
>> </Table>
>> <Chart Name="chart1">
>> <ThreeDProperties>
>> <Rotation>30</Rotation>
>> <Inclination>30</Inclination>
>> <Shading>Simple</Shading>
>> <WallThickness>50</WallThickness>
>> </ThreeDProperties>
>> <Style>
>> <BackgroundColor>White</BackgroundColor>
>> </Style>
>> <Legend>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> <Position>BottomCenter</Position>
>> <Layout>Table</Layout>
>> </Legend>
>> <Palette>Default</Palette>
>> <ChartData>
>> <ChartSeries>
>> <DataPoints>
>> <DataPoint>
>> <DataValues>
>> <DataValue>
>> <Value>=Sum(Fields!UnitsInStock.Value)</Value>
>> </DataValue>
>> </DataValues>
>> <DataLabel />
>> <Style>
>> <BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
>> </Style>
>> <Marker>
>> <Size>6pt</Size>
>> </Marker>
>> </DataPoint>
>> </DataPoints>
>> </ChartSeries>
>> </ChartData>
>> <CategoryAxis>
>> <Axis>
>> <Title />
>> <MajorGridLines>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </MajorGridLines>
>> <MinorGridLines>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </MinorGridLines>
>> <Min>0</Min>
>> </Axis>
>> </CategoryAxis>
>> <DataSetName>DataSet1</DataSetName>
>> <PointWidth>0</PointWidth>
>> <Type>Bar</Type>
>> <Top>0.25in</Top>
>> <Title />
>> <Width>3in</Width>
>> <Height>2.5in</Height>
>> <SeriesGroupings>
>> <SeriesGrouping>
>> <DynamicSeries>
>> <Grouping Name="chart1_SeriesGroup1">
>> <GroupExpressions>
>> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
>> </GroupExpressions>
>> </Grouping>
>> <Sorting>
>> <SortBy>
>> <SortExpression>=Fields!CategoryName.Value</SortExpression>
>> <Direction>Ascending</Direction>
>> </SortBy>
>> </Sorting>
>> <Label>=Fields!CategoryName.Value</Label>
>> </DynamicSeries>
>> </SeriesGrouping>
>> </SeriesGroupings>
>> <Subtype>Plain</Subtype>
>> <PlotArea>
>> <Style>
>> <BackgroundColor>LightGrey</BackgroundColor>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </PlotArea>
>> <Left>0.125in</Left>
>> <ValueAxis>
>> <Axis>
>> <Title />
>> <MajorGridLines>
>> <ShowGridLines>true</ShowGridLines>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </MajorGridLines>
>> <MinorGridLines>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </MinorGridLines>
>> <MajorTickMarks>Outside</MajorTickMarks>
>> <Min>0</Min>
>> <Margin>true</Margin>
>> <Visible>true</Visible>
>> <Scalar>true</Scalar>
>> </Axis>
>> </ValueAxis>
>> </Chart>
>> </ReportItems>
>> <Style />
>> <Height>3.25in</Height>
>> </Body>
>> <TopMargin>1in</TopMargin>
>> <DataSources>
>> <DataSource Name="Northwind">
>> <rd:DataSourceID>f646058b-4784-494d-a09d-27fde13a5679</rd:DataSourceID>
>> <ConnectionProperties>
>> <DataProvider>SQL</DataProvider>
>> <ConnectString>data source=(local);initial
>> catalog=Northwind</ConnectString>
>