Showing posts with label sub. Show all posts
Showing posts with label sub. Show all posts

Friday, March 23, 2012

Grouping a report

I am trying to group a report like so:
Company: ABC
Trip # Leg Amount
1 1 100
1 2 200
Sub Total 300
Trip # Leg Amount
2 1 100
2 2 200
Sub Total 300
Company: DEF
Trip # Leg Amount
3 1 100
3 2 200
Sub Total 300
Trip # Leg Amount
4 1 100
4 2 200
Sub Total 300
I get get the detail info in the report just fine with a grid. But
I'm running into problems when trying to add the company into the
grid. Currently I have a group created to get the sub total for each
trip and that works fine. But when I create the group to add the
company into the grid, it keeps putting the header columns (Trip #,
Leg, Amount, etc) above the company name. I have tried everything I
can think of to get the company name above it but can't get it to work.if you right click on the group row's headers(the grey part on the far
left when you have the table focused) you can insert a new group.
have a group with the company as the expression. then another with
the trip as the expression.
* company
* trip
** DETAILS|||I got it to work doing that and putting the column header row inside
my group row (instead of in a header row). But now I have another
question - not sure if this is possible, but since I am in a grid, my
Company name ends up in the same column as my trip number. The
company name is obviously going to be bigger than the trip number, but
if I stretch out the column to handle that, then the leg box looks
much larger than it needs to be (I'll try to show it here, but it'll
be tough):
Is there some way I can change the spacing on the company column
without affecting the leg column?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x Company: xx ABCDEFGHIJKLMNOPQ xx x
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x Trip # xx Leg xx Amount x
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x 1 xx 1 xx
100 x
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x 1 xx 2 xx
200 x
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x xx Sub Total xx 300
x
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Wednesday, March 21, 2012

Group Total Not working right

Hi,

I have a problem that i cannot figure out how to fix.

I have a sub report that i need to have the group totals in the Page header and i cannot for the life of me remember how to do this.

I have grouped by field 2 which gives me a time for Planned and unplanned events, I need to add up the time of the Planned items and put next to my Downtime Planned Text Box, and then sum the Unplanned and do the same against my unplanned downtime box

Regards SteveExample:
subreport 1 formula:
whileprintingrecords;
shared numbervar x:= sum({table.field})
subreport 2 formula:
whileprintingrecords;
shared numbervar y:= sum({table.field})
Formula in the main report:
whileprintingrecords;
shared numbervar x;
shared numbervar y;
x+y|||just to add some thing. You can use the sum function as

sum({table.field}, "Group on the field");

So you can get the planned and unplanned in the same subreport.|||Very confused with First reply, but will have a go at that, Second reply worked fine fo the same report

Regards

Steve

Monday, March 12, 2012

Group By/sub query problems

I'm trying to list salesreps (if they have any sales for a particular
date) with their total sales amounts for a queried date, but when
running this sql string in QueryAnalyzer, it says there is an error
with syntax on Line 1 near "s" :
SELECT o.Rep_ID, o.ID, s.ID, SUM(b.orderamount) AS totalsales,
b.order_ID
FROM (SELECT b.Deal_ID
FROM btransactions b
WHERE b.BoardDate = '20050815') SalesReps s INNER JOIN
orders o ON o.Rep_ID = s.ID INNER JOIN
b ON o.ID = b.Deal_ID
GROUP BY d.Rep_ID, d.ID, s.ID, b.order_ID
HAVING (SUM(b.orderamount) > 0)
?
NetSportsYou can only give a subquery one alias, you are trying to give it two
FROM (SELECT b.Deal_ID
FROM btransactions b
WHERE b.BoardDate = '20050815') SalesReps s
Should be:
FROM (SELECT b.Deal_ID
FROM btransactions b
WHERE b.BoardDate = '20050815') s
However, b is not in your outer query either.
The absolute best way to get a specific and useful answer is to post proper
specs (DDL, sample data, desired results). Check out
http://www.aspfaq.com/5006 which will help you get more constructive
responses.
"netsports" <ballz2wall@.cox-dot-net.no-spam.invalid> wrote in message
news:3bSdneDoYqzc2p_eRVn_vQ@.giganews.com...
> I'm trying to list salesreps (if they have any sales for a particular
> date) with their total sales amounts for a queried date, but when
> running this sql string in QueryAnalyzer, it says there is an error
> with syntax on Line 1 near "s" :
> SELECT o.Rep_ID, o.ID, s.ID, SUM(b.orderamount) AS totalsales,
> b.order_ID
> FROM (SELECT b.Deal_ID
> FROM btransactions b
> WHERE b.BoardDate = '20050815') SalesReps s INNER JOIN
> orders o ON o.Rep_ID = s.ID INNER JOIN
> b ON o.ID = b.Deal_ID
> GROUP BY d.Rep_ID, d.ID, s.ID, b.order_ID
> HAVING (SUM(b.orderamount) > 0)
> ?
> NetSports
>

Sunday, February 26, 2012

GROUP by clause, /sub query problems

I'm trying to list salesreps (if they have any sales for a particular date) with their total sales amounts for a queried date, but when running this sql string in QueryAnalyzer, it says there is an error with syntax on Line 1 near "s" :
SELECT o .Rep_ID, o .ID, s.ID, SUM(b.orderamount) AS totalsales, b.order_ID

FROM (SELECT b.Deal_ID

FROM btransactions b

WHERE b.BoardDate = '20050815') SalesReps s INNER JOIN

orders o ON o .Rep_ID = s.ID INNER JOIN

b ON o.ID = b.Deal_ID

GROUP BY d .Rep_ID, d .ID, s.ID, b.order_ID

HAVING (SUM(b.orderamount) > 0)
?
.NetSports

You have a space character following your "o" table alias throughoutyour query. Remove that extra space whereever it appears and seeif that clears up your problem.