Showing posts with label agent. Show all posts
Showing posts with label agent. Show all posts

Friday, March 30, 2012

Grouping Question

I have data from a dataset like this:

Dte Activity Agent Hours

-- - -

5/1/2007 activity1 agent1 11.0

5/1/2007 activity1 agent2 5.0

How would I group this data in a Table to display like this:

5/1/2007 activity1 agent1 11.0

agent2 5.0

What i've tried so far:

1) Using previous() to blank out Dte and Activity columns if previous is same as current. Does not work becuase agent2 shows many lines below agent1 depending on the size of activity(this field could be very long)

2) Grouping by Dte and Activity would not concat agent field and/ or hours field into one string.

3) Don't want to group concat in database if i don't have to. This makes suming values difficult on the reporting side.

Any ideas?

Thx

clarification:

1st grouping is date
2nd grouping is activity number

So why not just have two groupings?

(how do you tables in these forums?)

assume below is a grid 4 cols by 3 rows, representing a table in RS
where the top rop is "grouping one"
second row is "grouping two"
third row is detail
col1, row1: =fields!DateValue
col2,row2: = fields!ActivityValue
col3,row3: = fields!OtherData1.Value
col4,row3: = fields!OtherData2.Value
...etcsql

Monday, March 26, 2012

Grouping by Distinct

Hi,
I have 2 columns of data, one has an Agent code and the other has
information about the Agent. There are duplicates of the Agent code in the
1st column, but different info in the second. For example:
Col 1 Col 2
Agent 1 Data 1
Agent 1 Data 2
Agent 1 Data 3
Agent 2 Data 4
Agent 2 Data 5
Is there a way to only show the Agent once without duplicating it? I dont
want to sum or count anything, I just want to show the data like this:
Agent 1 Data 1
Data 2
Data 3
Agent 2 Data 4
Data 5
Does anyone know if this grouping is possible?
Thanks,
What you describe is more like a report than a query
result, but you can produce reports in SQL. One way
to do it is like this:
select
Col1, Col2
from (
select
Col1 as hidden1, Col1,
min(Col2) as hidden2, min(Col2) as Col2
from T
group by Col1
union all
select
Col1, '', Col2, space(2) + Col2
from T
where Col2 <> (
select min(Col2) from T as Tm
where Tm.Col1 = T.Col1
)
) T
order by hidden1, hidden2
-- Steve Kass
-- Drew University
PML wrote:

>Hi,
>I have 2 columns of data, one has an Agent code and the other has
>information about the Agent. There are duplicates of the Agent code in the
>1st column, but different info in the second. For example:
>Col 1 Col 2
>Agent 1 Data 1
>Agent 1 Data 2
>Agent 1 Data 3
>Agent 2 Data 4
>Agent 2 Data 5
>Is there a way to only show the Agent once without duplicating it? I dont
>want to sum or count anything, I just want to show the data like this:
>Agent 1 Data 1
> Data 2
> Data 3
>Agent 2 Data 4
> Data 5
>Does anyone know if this grouping is possible?
>Thanks,
>
>