Thursday, March 22, 2012
Combined Chart (One series with Line and One Bar)
I want to have one series charted as bar (sales) and the other series as
line (i.e market share).
Want to do it in one chart (not to overlay one chart over the other)
Thanx.Please read this related newsgroup posting:
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=c229b25c-b2dc-41ac-923d-decbb253dc6e&sloc=en-us
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Minas Papageorgiou" <MinasPapageorgiou@.discussions.microsoft.com> wrote in
message news:8AD71606-450E-4E5D-B4DD-12CA9A4A49C5@.microsoft.com...
> Is it possible to create combined charts with the Report Designer Chart?
> I want to have one series charted as bar (sales) and the other series as
> line (i.e market share).
> Want to do it in one chart (not to overlay one chart over the other)
> Thanx.
>
Thursday, March 8, 2012
Columns on Rows?
Excel and I am trying to normalize it. There is one could with an ID and
between 2 and 29 columns of varchar data. These columns are NULL for the
remainder of columns. here are a few rows:
1 abc def NULL NULL NULL etc...
2 qwe rty erd dsw NULL NULL etc...
3 abc fgh NULL NULL NULL NULL etc...
How do I write a query that will normalize this data?
I want something like this:
1 abc
1 def
2 qwe
2 rty
2 erd
2 dsw
3 abc
3 fgh
Thanks in advance,
TonyThis is a multi-part message in MIME format.
--=_NextPart_000_0312_01C37ECA.0AA38CD0
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Try:
select
ID
, Col
from
(
select
b.ID
, case x.Period
when 1 then b.Col1
when 2 then b.Col2
when 3 then b.Col3 -- and so on
end as Col
from
Budgets as b
cross join
(
select 1 as Period
union all
select 2
union all
select 3 -- and so on
) as x
) as y
where
Col is not null
order by
ID
-- Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Anthony Zessin" <Anthony.Zessin@.rrtc.com> wrote in message =news:#JrqsoufDHA.1700@.TK2MSFTNGP10.phx.gbl...
Plastic is on the bar, have a drink on me. I have a table that came =from
Excel and I am trying to normalize it. There is one could with an ID =and
between 2 and 29 columns of varchar data. These columns are NULL for =the
remainder of columns. here are a few rows:
1 abc def NULL NULL NULL etc...
2 qwe rty erd dsw NULL NULL etc...
3 abc fgh NULL NULL NULL NULL etc...
How do I write a query that will normalize this data?
I want something like this:
1 abc
1 def
2 qwe
2 rty
2 erd
2 dsw
3 abc
3 fgh
Thanks in advance,
Tony
--=_NextPart_000_0312_01C37ECA.0AA38CD0
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&
Try:
select
ID
, Col
from
(
select
b.ID
, =case x.Period
=when 1 then b.Col1
=when 2 then b.Col2
=when 3 then b.Col3 -- and so on
end =as Col
from
=Budgets as b
cross join
(
=select 1 as Period
=union all
=select 2
=union all
=select 3 -- and so on
) as x
) as y
where
Col is not null
order by
ID
-- Tom
---T=homas A. Moreau, BSc, PhD, MCSE, MCDBASQL Server MVPColumnist, SQL =Server ProfessionalToronto, ON Canadahttp://www.pinnaclepublishing.com/sql">www.pinnaclepublishing.com=/sql
"Anthony Zessin" =wrote in message news:#JrqsoufDHA.1700=@.TK2MSFTNGP10.phx.gbl...Plastic is on the bar, have a drink on me. I have a table that came =fromExcel and I am trying to normalize it. There is one could with an ID andbetween 2 and 29 columns of varchar data. These columns are =NULL for theremainder of columns. here are a few rows:1 abc =def NULL NULL =NULL etc...2 qwe =rty erd dsw NULL NULL etc...3 =abc fgh NULL =NULL NULL NULL etc...How do I =write a query that will normalize this data?I want something like this:1 abc1 def2 qwe2 =rty2 erd2 dsw3 =abc3 fghThanks in advance,Tony
--=_NextPart_000_0312_01C37ECA.0AA38CD0--|||Cross-tab query / pivot table.
Code:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q175574
http://msdn.microsoft.com/library/en-us/acdata/ac_8_qd_14_04j7.asp
http://www.sqlmag.com/Articles/Index.cfm?ArticleID=15608
http://www.sqlteam.com/item.asp?ItemID=2955
Software:
http://www.rac4sql.net
http://www.ag-software.com/xp_ags_crosstab.asp
http://www.tysonsoftware.co.uk/TheQueryTool.asp
"Anthony Zessin" <Anthony.Zessin@.rrtc.com> wrote in message
news:#JrqsoufDHA.1700@.TK2MSFTNGP10.phx.gbl...
> Plastic is on the bar, have a drink on me. I have a table that came from
> Excel and I am trying to normalize it. There is one could with an ID and
> between 2 and 29 columns of varchar data. These columns are NULL for the
> remainder of columns. here are a few rows:
> 1 abc def NULL NULL NULL etc...
> 2 qwe rty erd dsw NULL NULL etc...
> 3 abc fgh NULL NULL NULL NULL etc...
> How do I write a query that will normalize this data?
> I want something like this:
> 1 abc
> 1 def
> 2 qwe
> 2 rty
> 2 erd
> 2 dsw
> 3 abc
> 3 fgh
>
> Thanks in advance,
> Tony
>
>|||An approach using UDF and cursor.
Create sample data :
drop table tt
create table tt (i int, col1 varchar(5), col2 varchar(5))
insert into tt values(1, 'val1', 'val2')
insert into tt values(2, 'val1', 'val2')
insert into tt values(3, 'val1', 'val2')
--you will have to create a function that will change columnn seperated values to the rows.
--create a function as it is no need to change it. only change the way you call it as
--shown in the following script.
CREATE FUNCTION seperator
(@.str varchar(8000), @.del varchar(1))
RETURNS @.fin_tab TABLE (val varchar(8000)) AS
BEGIN
DECLARE @.pos int
DECLARE @.final_val varchar(8000)
SELECT @.str = LTRIM(RTRIM(@.str))
IF RIGHT(@.str,1) = @.del
set @.str = LEFT(@.str, Len(@.str) - 1)
set @.pos = charindex(@.del, @.str)
WHILE @.pos > 0
BEGIN
SET @.final_val = left(@.str, charindex(@.del, @.str) - 1)
INSERT @.fin_tab VALUES(@.final_val )
select @.str = substring(@.str, @.pos + 1, len(@.str)), @.pos = charindex(@.del, @.str)
END
INSERT @.fin_tab VALUES(@.str)
RETURN
END
go
--Following is the T-SQL code to call the above function and loop through the table.
declare @.i int, @.col1 varchar(5), @.col2 varchar(5)
declare @.str varchar(8000)
if object_id('tempdb..#temp_tab') is not null
drop table #temp_tab
create table #temp_tab(i int, crostab_col varchar(5))
declare c1 cursor static for
SELECT i, col1, col2 from tt
open c1
fetch next from c1 into @.i, @.col1, @.col2
while @.@.fetch_status = 0
begin
set @.str = @.col1 + ';' + @.col2
insert into #temp_tab
select @.i idd ,val from seperator(@.str , ';')
fetch next from c1 into @.i, @.col1, @.col2
end
close c1
deallocate c1
--final table with the columns turned to rows. of the above TT table
select * from #temp_Tab
--
- Vishal|||This is a multi-part message in MIME format.
--=_NextPart_000_0015_01C37EBB.3E88E950
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Brilliant! Thank you.
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message =news:OsY3UuufDHA.3616@.TK2MSFTNGP11.phx.gbl...
Try:
select
ID
, Col
from
(
select
b.ID
, case x.Period
when 1 then b.Col1
when 2 then b.Col2
when 3 then b.Col3 -- and so on
end as Col
from
Budgets as b
cross join
(
select 1 as Period
union all
select 2
union all
select 3 -- and so on
) as x
) as y
where
Col is not null
order by
ID
-- Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Anthony Zessin" <Anthony.Zessin@.rrtc.com> wrote in message =news:#JrqsoufDHA.1700@.TK2MSFTNGP10.phx.gbl...
Plastic is on the bar, have a drink on me. I have a table that came =from
Excel and I am trying to normalize it. There is one could with an ID =and
between 2 and 29 columns of varchar data. These columns are NULL for =the
remainder of columns. here are a few rows:
1 abc def NULL NULL NULL etc...
2 qwe rty erd dsw NULL NULL etc...
3 abc fgh NULL NULL NULL NULL etc...
How do I write a query that will normalize this data?
I want something like this:
1 abc
1 def
2 qwe
2 rty
2 erd
2 dsw
3 abc
3 fgh
Thanks in advance,
Tony
--=_NextPart_000_0015_01C37EBB.3E88E950
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:o =3D "urn:schemas-microsoft-com:office:office"><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.2800.1226" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#c0c0c0>
<DIV><FONT face=3DArial size=3D2>Brilliant! </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thank you.</FONT></DIV>
<BLOCKQUOTE style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Tom Moreau" <<A =href=3D"mailto:tom@.dont.spam.me.cips.ca">tom@.dont.spam.me.cips.ca</A>>= wrote in message <A =href=3D"news:OsY3UuufDHA.3616@.TK2MSFTNGP11.phx.gbl">news:OsY3UuufDHA.3616=@.TK2MSFTNGP11.phx.gbl</A>...</DIV>
<DIV><FONT face=3DTahoma size=3D2>Try:</FONT></DIV>
<DIV><FONT face=3DTahoma size=3D2></FONT> </DIV>
<DIV>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>select</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2> ID</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>, Col</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>from</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>(</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>select<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> </SPAN>b.ID</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>,<SPAN style=3D"mso-spacerun: yes"> =</SPAN>case x.Period<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =
</SPAN>when 1 then b.Col1<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =
</SPAN>when 2 then b.Col2<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =
</SPAN>when 3 then b.Col3 -- and so on</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>end as Col</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>from<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>Budgets as b<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>cross join<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>(<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>select 1 as Period<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>union all<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>select 2<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>union all<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>select 3 -- and so on<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>) as x</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>) as y</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>where</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><o:p><FONT size=3D2> Col is not null</FONT></o:p></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>order by<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> </SPAN>ID</FONT></SPAN></P></DIV>
<DIV><BR>-- <BR>Tom</DIV>
<DIV> </DIV>
=<DIV>---<BR>T=homas A. Moreau, BSc, PhD, MCSE, MCDBA<BR>SQL Server MVP<BR>Columnist, SQL =Server Professional<BR>Toronto, ON Canada<BR><A =href=3D"www.pinnaclepublishing.com=">http://www.pinnaclepublishing.com/sql">www.pinnaclepublishing.com=
/sql</A></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>"Anthony Zessin" <<A =href=3D"mailto:Anthony.Zessin@.rrtc.com">Anthony.Zessin@.rrtc.com</A>> =wrote in message <A =href=3D"news:#JrqsoufDHA.1700@.TK2MSFTNGP10.phx.gbl">news:#JrqsoufDHA.1700=@.TK2MSFTNGP10.phx.gbl</A>...</DIV>Plastic is on the bar, have a drink on me. I have a table that came from<BR>Excel and I am trying to normalize it. There is one =could with an ID and<BR>between 2 and 29 columns of varchar data. These =columns are NULL for the<BR>remainder of columns. here are a few rows:<BR><BR>1 abc =def NULL NULL =NULL etc...<BR>2 qwe =rty erd dsw NULL NULL etc...<BR>3 =abc fgh NULL =NULL NULL NULL etc...<BR><BR>How do I =write a query that will normalize this data?<BR>I want something like this:<BR><BR>1 abc<BR>1 def<BR>2 qwe<BR>2 rty<BR>2 erd<BR>2 dsw<BR>3 abc<BR>3 =fgh<BR><BR><BR>Thanks in advance,<BR>Tony<BR><BR><BR></BLOCKQUOTE></BODY></HTML>
--=_NextPart_000_0015_01C37EBB.3E88E950--|||This is a multi-part message in MIME format.
--=_NextPart_000_0025_01C37EE6.F21FBD10
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Um, about that plastic on the bar. I'd like a cold beer and a Dr. =McGillicuddy's Peppermint Schnapps - to go. ;-)
-- Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
.
"Anthony Zessin" <Anthony.Zessin@.rrtc.com> wrote in message =news:uCO9rXvfDHA.2188@.TK2MSFTNGP10.phx.gbl...
Brilliant! Thank you.
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message =news:OsY3UuufDHA.3616@.TK2MSFTNGP11.phx.gbl...
Try:
select
ID
, Col
from
(
select
b.ID
, case x.Period
when 1 then b.Col1
when 2 then b.Col2
when 3 then b.Col3 -- and so on
end as Col
from
Budgets as b
cross join
(
select 1 as Period
union all
select 2
union all
select 3 -- and so on
) as x
) as y
where
Col is not null
order by
ID
-- Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Anthony Zessin" <Anthony.Zessin@.rrtc.com> wrote in message =news:#JrqsoufDHA.1700@.TK2MSFTNGP10.phx.gbl...
Plastic is on the bar, have a drink on me. I have a table that came =from
Excel and I am trying to normalize it. There is one could with an ID =and
between 2 and 29 columns of varchar data. These columns are NULL for =the
remainder of columns. here are a few rows:
1 abc def NULL NULL NULL etc...
2 qwe rty erd dsw NULL NULL etc...
3 abc fgh NULL NULL NULL NULL etc...
How do I write a query that will normalize this data?
I want something like this:
1 abc
1 def
2 qwe
2 rty
2 erd
2 dsw
3 abc
3 fgh
Thanks in advance,
Tony
--=_NextPart_000_0025_01C37EE6.F21FBD10
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:o =3D "urn:schemas-microsoft-com:office:office"><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.2800.1226" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#c0c0c0>
<DIV><FONT face=3DTahoma size=3D2>Um, about that plastic on the =bar. I'd like a cold beer and a Dr. McGillicuddy's Peppermint Schnapps - to go. ;-)</FONT></DIV>
<DIV><BR>-- <BR> Tom</DIV>
<DIV> </DIV>
<DIV>----<BR>Thomas A. =Moreau, BSc, PhD, MCSE, MCDBA<BR>SQL Server MVP<BR>Columnist, SQL Server Professional<BR>Toronto, ON Canada<BR><A href=3D"www.pinnaclepublishing.com=">http://www.pinnaclepublishing.com/sql">www.pinnaclepublishing.com=
/sql</A><BR>.</DIV>
<DIV>"Anthony Zessin" <<A href=3D"mailto:Anthony.Zessin@.rrtc.com">Anthony.Zessin@.rrtc.com</A>> =wrote in message <A href=3D"news:uCO9rXvfDHA.2188@.TK2MSFTNGP10.phx.gbl">news:uCO9rXvfDHA.2188=@.TK2MSFTNGP10.phx.gbl</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Brilliant! </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thank you.</FONT></DIV>
<BLOCKQUOTE style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Tom Moreau" <<A =href=3D"mailto:tom@.dont.spam.me.cips.ca">tom@.dont.spam.me.cips.ca</A>>= wrote in message <A =href=3D"news:OsY3UuufDHA.3616@.TK2MSFTNGP11.phx.gbl">news:OsY3UuufDHA.3616=@.TK2MSFTNGP11.phx.gbl</A>...</DIV>
<DIV><FONT face=3DTahoma size=3D2>Try:</FONT></DIV>
<DIV><FONT face=3DTahoma size=3D2></FONT> </DIV>
<DIV>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>select</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2> ID</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>, Col</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>from</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>(</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>select<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> </SPAN>b.ID</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>,<SPAN style=3D"mso-spacerun: yes"> =</SPAN>case x.Period<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =
</SPAN>when 1 then b.Col1<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =
</SPAN>when 2 then b.Col2<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =
</SPAN>when 3 then b.Col3 -- and so on</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>end as Col</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>from<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>Budgets as b<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>cross join<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>(<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>select 1 as Period<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>union all<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>select 2<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>union all<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> =</SPAN>select 3 -- and so on<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>) as x</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>) as y</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>where</FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><o:p><FONT size=3D2> Col is not null</FONT></o:p></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2>order by<o:p></o:p></FONT></SPAN></P>
<P class=3Dbodytext style=3D"MARGIN: 0in 0in 0pt"><SPAN lang=3DEN-US style=3D"FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; =mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New =Roman'"><FONT size=3D2><SPAN style=3D"mso-spacerun: yes"> </SPAN>ID</FONT></SPAN></P></DIV>
<DIV><BR>-- <BR>Tom</DIV>
<DIV> </DIV>
=<DIV>---<BR>T=homas A. Moreau, BSc, PhD, MCSE, MCDBA<BR>SQL Server MVP<BR>Columnist, SQL =Server Professional<BR>Toronto, ON Canada<BR><A =href=3D"www.pinnaclepublishing.com=">http://www.pinnaclepublishing.com/sql">www.pinnaclepublishing.com=
/sql</A></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>"Anthony Zessin" <<A =href=3D"mailto:Anthony.Zessin@.rrtc.com">Anthony.Zessin@.rrtc.com</A>> =wrote in message <A =href=3D"news:#JrqsoufDHA.1700@.TK2MSFTNGP10.phx.gbl">news:#JrqsoufDHA.1700=@.TK2MSFTNGP10.phx.gbl</A>...</DIV>Plastic is on the bar, have a drink on me. I have a table that came from<BR>Excel and I am trying to normalize it. There is one =could with an ID and<BR>between 2 and 29 columns of varchar data. These =columns are NULL for the<BR>remainder of columns. here are a few rows:<BR><BR>1 abc =def NULL NULL =NULL etc...<BR>2 qwe =rty erd dsw NULL NULL etc...<BR>3 =abc fgh NULL =NULL NULL NULL etc...<BR><BR>How do I =write a query that will normalize this data?<BR>I want something like this:<BR><BR>1 abc<BR>1 def<BR>2 qwe<BR>2 rty<BR>2 erd<BR>2 dsw<BR>3 abc<BR>3 =fgh<BR><BR><BR>Thanks in advance,<BR>Tony<BR><BR><BR></BLOCKQUOTE></BODY></HTML>
--=_NextPart_000_0025_01C37EE6.F21FBD10--|||This is a multi-part message in MIME format.
--=_NextPart_000_0032_01C37EE6.FA7CB300
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
A cursor, you say? ;-)
-- Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
.
"Vishal Parkar" <vgparkar@.hotmail.com> wrote in message =news:uhz$hzufDHA.3200@.tk2msftngp13.phx.gbl...
An approach using UDF and cursor.
Create sample data :
drop table tt
create table tt (i int, col1 varchar(5), col2 varchar(5))
insert into tt values(1, 'val1', 'val2')
insert into tt values(2, 'val1', 'val2')
insert into tt values(3, 'val1', 'val2')
--you will have to create a function that will change columnn seperated =values to the rows.
--create a function as it is no need to change it. only change the way =you call it as
--shown in the following script.
CREATE FUNCTION seperator
(@.str varchar(8000), @.del varchar(1))
RETURNS @.fin_tab TABLE (val varchar(8000)) AS
BEGIN
DECLARE @.pos int
DECLARE @.final_val varchar(8000)
SELECT @.str =3D LTRIM(RTRIM(@.str))
IF RIGHT(@.str,1) =3D @.del
set @.str =3D LEFT(@.str, Len(@.str) - 1)
set @.pos =3D charindex(@.del, @.str)
WHILE @.pos > 0
BEGIN
SET @.final_val =3D left(@.str, charindex(@.del, @.str) - 1)
INSERT @.fin_tab VALUES(@.final_val )
select @.str =3D substring(@.str, @.pos + 1, len(@.str)), @.pos =3D =charindex(@.del, @.str)
END
INSERT @.fin_tab VALUES(@.str)
RETURN
END
go
--Following is the T-SQL code to call the above function and loop =through the table.
declare @.i int, @.col1 varchar(5), @.col2 varchar(5)
declare @.str varchar(8000)
if object_id('tempdb..#temp_tab') is not null
drop table #temp_tab
create table #temp_tab(i int, crostab_col varchar(5))
declare c1 cursor static for
SELECT i, col1, col2 from tt
open c1
fetch next from c1 into @.i, @.col1, @.col2
while @.@.fetch_status =3D 0
begin
set @.str =3D @.col1 + ';' + @.col2
insert into #temp_tab
select @.i idd ,val from seperator(@.str , ';')
fetch next from c1 into @.i, @.col1, @.col2
end
close c1
deallocate c1
--final table with the columns turned to rows. of the above TT table
select * from #temp_Tab
--
- Vishal
--=_NextPart_000_0032_01C37EE6.FA7CB300
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&
A cursor, you say? =;-)
-- Tom
----Thomas A. =Moreau, BSc, PhD, MCSE, MCDBASQL Server MVPColumnist, SQL Server ProfessionalToronto, ON Canadahttp://www.pinnaclepublishing.com/sql">www.pinnaclepublishing.com=/sql.
"Vishal Parkar"
--=_NextPart_000_0032_01C37EE6.FA7CB300--|||This is a multi-part message in MIME format.
--=_NextPart_000_0554_01C37F38.61804C00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
That wasn't as brilliant as yours, Tom :-)
-- - Vishal
--=_NextPart_000_0554_01C37F38.61804C00
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&
That wasn't as brilliant as yours, Tom =:-)
-- - =Vishal
--=_NextPart_000_0554_01C37F38.61804C00--
Thursday, February 16, 2012
Column Chart Bar Borders
Can I add borders to my bars in the column chart? My bars don't appear to have any border, and I can't see a place to set one. I am using SSRS Express.
Thanks!
Michael
1)Double click the bar chart
2)Double click the chart value in the "Drop data fields here"
3)Select the Appearance tab
4)Click on the Series Style at the bottom of the dialog box
5)Choose your style and your color for "Border and Line"
6)Click OK, Click OK
|||Ah, so much better. Thanks! I knew I had seen the option before, but couldn't find it. I HAD right clicked on the drop data fields items for the other two axes, but not that VALUE axis. Grrr... Thanks for the help!
Michael
Tuesday, February 14, 2012
Colors in legend does not match bar graph
Hi
I have a bar graph with custom colors applied to it.
The custom colors displays nicely in the bar graph, but not in the legend.
The legend displays a mix of some of the "correct" custom colors, and some of the "wrong" standard colors. The colors in the legend vary, depending on the parameters passed to the report. Sometimes legend colors are all right, other times all wrong but must times a mix of right and wrongs.
The value for the custom color of the graph is retrieved from a field in the dataset. However I doubt that this is the cause of the error because, the bar graph colors are correct at all times, and I have validated thet correct color names are actually in the dataset.
Hope someone can help me out with this one...
/Henrik
The legend color always depends on the color of the first datapoint in a chart series.Also, is a series grouping present in the chart? In that case you have to make sure that e.g. instead of using =Code.PickColor( Fields!ResultSort.Value), you should use this expression that uses the First() aggregate: =Code.PickColor(First(Fields!ResultSort.Value, "chart1_SeriesGroup1")
The important part is the aggregate scope which has to be identical to the chart series grouping name. Just using the First aggregate without the scope will give you incorrect results, because the aggregate will be just scoped for every chart datapoint (and therefore null if you don't have any datapoints for a particular series group / category group combination).
Another option you may consider is using a "custom legend" which is not drawn inside the chart but created by a table besides the chart. My sample and instructions for this can be found in the following blog article:
http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx
-- Robert
|||
Thanks a lot Robert.
It was the aggregate scope I was missing. It's all working fine now.
/Henrik
|||Does this apply for Gray Scale? I am having trouble when I set a chart to use Gray Scale the legend shows the first set of patterns but the remaining patterns are all random. I tried adding the scope to the Data section of the chart but it doesn't change the behavior with Gray Scale. Also, if it's a bug, is there a way that I can specify fill patterns in case I write a function to pick the pattern based on the series? Thanks!
Colors in legend does not match bar graph
Hi
I have a bar graph with custom colors applied to it.
The custom colors displays nicely in the bar graph, but not in the legend.
The legend displays a mix of some of the "correct" custom colors, and some of the "wrong" standard colors. The colors in the legend vary, depending on the parameters passed to the report. Sometimes legend colors are all right, other times all wrong but must times a mix of right and wrongs.
The value for the custom color of the graph is retrieved from a field in the dataset. However I doubt that this is the cause of the error because, the bar graph colors are correct at all times, and I have validated thet correct color names are actually in the dataset.
Hope someone can help me out with this one...
/Henrik
The legend color always depends on the color of the first datapoint in a chart series.Also, is a series grouping present in the chart? In that case you have to make sure that e.g. instead of using =Code.PickColor( Fields!ResultSort.Value), you should use this expression that uses the First() aggregate: =Code.PickColor(First(Fields!ResultSort.Value, "chart1_SeriesGroup1")
The important part is the aggregate scope which has to be identical to the chart series grouping name. Just using the First aggregate without the scope will give you incorrect results, because the aggregate will be just scoped for every chart datapoint (and therefore null if you don't have any datapoints for a particular series group / category group combination).
Another option you may consider is using a "custom legend" which is not drawn inside the chart but created by a table besides the chart. My sample and instructions for this can be found in the following blog article:
http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx
-- Robert
|||
Thanks a lot Robert.
It was the aggregate scope I was missing. It's all working fine now.
/Henrik
|||Does this apply for Gray Scale? I am having trouble when I set a chart to use Gray Scale the legend shows the first set of patterns but the remaining patterns are all random. I tried adding the scope to the Data section of the chart but it doesn't change the behavior with Gray Scale. Also, if it's a bug, is there a way that I can specify fill patterns in case I write a function to pick the pattern based on the series? Thanks!