Showing posts with label simply. Show all posts
Showing posts with label simply. Show all posts

Wednesday, March 21, 2012

Lines

I have a report that I need to add a line every 5 records (don't ask!), I
can't see anyway to do this simply using the line control.
Am I missing something or do I have to look at doing this progmatically?Found the answer.
I added a border to the bottom of the detail row in a table control and then
set the borders visibility to an expression so that it was only visible every
5 rows.

Monday, March 19, 2012

Line Chart in RS - simple design question

I have a simply data file that I want to make a time-based line chart and I can't seem to get charts in RS to do it. The data file structure is as follows: (first line is column labels and each row is a case with three data points - one for each year)

school 2003 2004 2005

SchA 100 122 133

SchB 121 145 115

SchC 98 112 120

I can't seem to get the right series, category, and data fields to get a very simple line chart for each school (one trend line for each school connecting the three data points all one the same chart). It's trivial in Excel and using pivot tables, but RS charts is not structured the same way.?

The fields in the SQL result set returned are School, 2003, 2004, & 2005.

Any help for this seemingly simply problem would be appreciated. Thanks

Ed Sloat

your resultset has to look like this:

Year SchA SchB SchC

2003 100 121 98

2004 122 145 112

2005 133 115 120

SchA, SchB, SchC are your value fields
Year is your category field

this should work fine|||

Gerhard, Thanks for the reply. I did try this and it does work but it requires a fundemental restructuring of the underlying data. From your answer, I am guessing the RS charting assumes a single static (required) data structure for the charting features and does not allow for flexibility in the defining the data rerlationships,... which makes it much less functional than charting in Excel or in other statistical/data analysis software. Seem like it makes some pretty trival/common data display tasks much more difficult.

Thanks.

Ed

|||

OK, Select the line chart, then Select School and drop them under 'Drop Series fields here', Select years and drop them under 'Drop Categroy fields here' and finally Select the data fields and drop them 'Drop data fields here' areas.

Line Chart in RS - simple design question

I have a simply data file that I want to make a time-based line chart and I can't seem to get charts in RS to do it. The data file structure is as follows: (first line is column labels and each row is a case with three data points - one for each year)

school 2003 2004 2005

SchA 100 122 133

SchB 121 145 115

SchC 98 112 120

I can't seem to get the right series, category, and data fields to get a very simple line chart for each school (one trend line for each school connecting the three data points all one the same chart). It's trivial in Excel and using pivot tables, but RS charts is not structured the same way.?

The fields in the SQL result set returned are School, 2003, 2004, & 2005.

Any help for this seemingly simply problem would be appreciated. Thanks

Ed Sloat

your resultset has to look like this:

Year SchA SchB SchC

2003 100 121 98

2004 122 145 112

2005 133 115 120

SchA, SchB, SchC are your value fields
Year is your category field

this should work fine
|||

Gerhard, Thanks for the reply. I did try this and it does work but it requires a fundemental restructuring of the underlying data. From your answer, I am guessing the RS charting assumes a single static (required) data structure for the charting features and does not allow for flexibility in the defining the data rerlationships,... which makes it much less functional than charting in Excel or in other statistical/data analysis software. Seem like it makes some pretty trival/common data display tasks much more difficult.

Thanks.

Ed

|||

OK, Select the line chart, then Select School and drop them under 'Drop Series fields here', Select years and drop them under 'Drop Categroy fields here' and finally Select the data fields and drop them 'Drop data fields here' areas.

Monday, March 12, 2012

Limiting SQL results

I have a query that simply needs to determine if data exists in a table for
a given key.
Initially I used COUNT:
Select COUNT(*) from TABLEWITHTONSODATA Where Key = 'X'
The table has about 500,000 of rows so this takes too long.
Then I used TOP to speed things up. But TOP causes a timeout if key X isn't
in the table.
Does anyone have any suggestions on how to simply determine if key X has
records without counting every record?
Does anyone have a clue why TOP goes into never-never land if the table has
a lot of rows?
ThanksTry
if exists (Select 1 from TABLEWITHTONSODATA Where Key = 'X')
begin
...
end
"A" <agarrettbNOSPAM@.hotmail.com> wrote in message
news:eF6nK$sqDHA.2592@.TK2MSFTNGP10.phx.gbl...
> I have a query that simply needs to determine if data exists in a table
for
> a given key.
> Initially I used COUNT:
> Select COUNT(*) from TABLEWITHTONSODATA Where Key = 'X'
> The table has about 500,000 of rows so this takes too long.
> Then I used TOP to speed things up. But TOP causes a timeout if key X
isn't
> in the table.
> Does anyone have any suggestions on how to simply determine if key X has
> records without counting every record?
> Does anyone have a clue why TOP goes into never-never land if the table
has
> a lot of rows?
> Thanks
>|||Use EXISTS:
...
EXISTS
(SELECT *
FROM tablewithtonsodata
WHERE key = 'X')
If it's still too slow then consider indexing the column "key".
--
David Portas
--
Please reply only to the newsgroup
--|||You could do...
IF EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
SELECT 1
Or I believe this would perform equally well:
SELECT 1 WHERE EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
COUNT(*) has to actually go and count all of the rows. TOP has to return
based on ordering of some sort. EXISTS just needs to find a single row that
matches.
I assume that Key is indexed?
"A" <agarrettbNOSPAM@.hotmail.com> wrote in message
news:eF6nK$sqDHA.2592@.TK2MSFTNGP10.phx.gbl...
> I have a query that simply needs to determine if data exists in a table
for
> a given key.
> Initially I used COUNT:
> Select COUNT(*) from TABLEWITHTONSODATA Where Key = 'X'
> The table has about 500,000 of rows so this takes too long.
> Then I used TOP to speed things up. But TOP causes a timeout if key X
isn't
> in the table.
> Does anyone have any suggestions on how to simply determine if key X has
> records without counting every record?
> Does anyone have a clue why TOP goes into never-never land if the table
has
> a lot of rows?
> Thanks
>|||All great suggestions...will try. I am still wondering if anyone else has
had problems with TOP in large tables.
"A" <agarrettbNOSPAM@.hotmail.com> wrote in message
news:eF6nK$sqDHA.2592@.TK2MSFTNGP10.phx.gbl...
> I have a query that simply needs to determine if data exists in a table
for
> a given key.
> Initially I used COUNT:
> Select COUNT(*) from TABLEWITHTONSODATA Where Key = 'X'
> The table has about 500,000 of rows so this takes too long.
> Then I used TOP to speed things up. But TOP causes a timeout if key X
isn't
> in the table.
> Does anyone have any suggestions on how to simply determine if key X has
> records without counting every record?
> Does anyone have a clue why TOP goes into never-never land if the table
has
> a lot of rows?
> Thanks
>|||In article <ueHi#GtqDHA.1632@.TK2MSFTNGP10.phx.gbl>, amachanic@.air-
worldwide.nospamallowed.com said...
> You could do...
> IF EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
> SELECT 1
> Or I believe this would perform equally well:
> SELECT 1 WHERE EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
> COUNT(*) has to actually go and count all of the rows. TOP has to return
> based on ordering of some sort. EXISTS just needs to find a single row that
> matches.
Top doesn't have to have an order. I would think you would want to go
with:
IF EXISTS (SELECT TOP 1 'X' FROM TableWithTonsOfData With (NoLock) Where
Key = 'X')
-- Do your thing
The NoLock should help depending on usage.|||"Brad" <me@.privacy.net> wrote in message
news:MPG.1a1f0ba92c81d36f98b995@.news...
> Top doesn't have to have an order. I would think you would want to go
> with:
An unordered TOP is meaningless. TOP 1 what?|||In article <OuROemvqDHA.3732@.tk2msftngp13.phx.gbl>, amachanic@.air-
worldwide.nospamallowed.com said...
> "Brad" <me@.privacy.net> wrote in message
> news:MPG.1a1f0ba92c81d36f98b995@.news...
> > Top doesn't have to have an order. I would think you would want to go
> > with:
> An unordered TOP is meaningless. TOP 1 what?
It doesn't matter in his case because he is just checking existence. Top
1 is perfect for that because it tells the server to find one record in
whatever order is easiest and then stop.
I use top 1 * or top 10 * all of the time to just get a sample record(s).|||Brad wrote:
> In article <ueHi#GtqDHA.1632@.TK2MSFTNGP10.phx.gbl>, amachanic@.air-
> worldwide.nospamallowed.com said...
> > You could do...
> >
> > IF EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
> > SELECT 1
> >
> > Or I believe this would perform equally well:
> >
> > SELECT 1 WHERE EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
> >
> > COUNT(*) has to actually go and count all of the rows. TOP has to return
> > based on ordering of some sort. EXISTS just needs to find a single row that
> > matches.
> Top doesn't have to have an order. I would think you would want to go
> with:
> IF EXISTS (SELECT TOP 1 'X' FROM TableWithTonsOfData With (NoLock) Where
> Key = 'X')
> -- Do your thing
> The NoLock should help depending on usage.
Using EXISTS(SELECT TOP 1) will not be faster than EXIST(SELECT *), but
equally fast. This is because both can be satisfied with exactly the
same algorithm.
For that reason I would suggest you use the ANSI-SQL standard, and avoid
the SQL-Server proprietary TOP keyword.
Gert-Jan