i’m facing the following problem,
the table has two columns
emp_id team_name
1 medical
1 tech
the problem is my customer want the team_name displayed in one column, i.e.
1 medical,tech
i think it’s impossible to have this accomplished in SQL ,then i tried defining the team_name as a “measure” object but it seems that projections cannot be applied to strings. what i want is just concatenate the team_names under the same emp_id.
plz help me out!
This is probably best accomplished via a view on the database side. That will let you have about 256 groups or so through the use of a BITAND type operation as you’ve described it.
It would take 2-3 views to flatten out your data, but it can be done as long as you are not dealing with too many variables. (There really isn’t an upper limit on how much this can handle, but there is on how much code you want to have to maintain).
create view emp_coding(emp_id,team_code)
as select emp_id,sum(decode(team,"medical",1,"tech",2,0))
from emp
group by emp_id;
create view emp_decoding(emp_id,teams)
as
select emp_id,decode(bitand(team_code,2),2,"tech)||","||decode(bitand(team_code,1),1,"medical");
from emp_coding
since there are not too many teams , it’s at least acceptable,
i hope it would turn out to be a maintenance nightmare
Which version are you on??? Defining it as a Measure and setting the projection to SUM should have worked… Also you need to set the TYPE of the Object to either Character or Long Text… Now when you do this you will not get Comma between various Team Name but should get the Team Name for an Emp ID in a single row… If you want “,” between Team Name you need to change the object definition at the Universe Level to concatenate “,” and then at the report side trim the last “,”.
Maybe the version but not sure!!! When you do that what is the output you are getting??? Does it show the name in separate rows… If possible send the report to me and will check how it shows it at my side…