Bex: Show Data present in multiple rows in single row
Hi ,
I have a dso with field and data like
Material itemtype Launch Date Text
1. 100001 10 10/11/2010 delivered to x
2. 100001 20 10/11/2010 not delivered
3. 100001 30 05/12/2010 delivered to y
i have to show this data in report as single record with format condition like
Material itemtypetext 10 itemtypetext 20 itemtypetext 30
100001 delivered to x not delivered delivered to y
here the itemtypetext 10 value is calculated as = if itemtype=10 and Launch date < today
the itemtypetext 20 value is calculated as = if itemtype=20 and Launch date < today
the itemtypetext 30 value is calculated as = if itemtype=30 and Launch date < today
Thanks
Prashant
Material itemtypetext10 itemtypetext20 itemtypetext 30
100001 delivered to x not delivered delivered to y
Can you please tell me how can i achieve this. and is it better to do in Datamodel or in Bex reporting?
Hi,
i dont understand what your meaning about value of itemtype text? Could you please explain it again clearly or give uns a complete example?
This condition is a bit complex for query formular to realize it, Instead of it you could create a new virtuell Characteristic with a flag to do it. e.g If lauch < today, this flag will be '1', else will be '0'. Then we could restrict KF in the query to calculate.
Similar Messages
-
SSRS - multiple toggle in single row item to drill down sub report
I need to open a sub report using drill down concept. Is there any possible to give toggle for multiple columns in single row.
http://social.msdn.microsoft.com/Forums/getfile/528971
The sub report have two parameters to show data. If I click first link the subreport to be drill down with parameters 1 and 5. If I click second link the
same sub report to be drill through with different parametrs as 2 and 6.
Any idea to do this?Thanks for your reply.
I do it this in different way.
See the below sample image url. I created the main report having four details with toggle to drill down the sub report. If I click the Detail1 the
subreport1 will expand drill down then I click Detail2 the subreport2 to be expand.
But still the subreport1 is visible I want to collapse Subreort1 once click toggle second and vice versa.
Please give your suggetions.
http://social.msdn.microsoft.com/Forums/getfile/529184 -
Merge multiple rows into single row (but multiple columns)
How to merge multiple rows into single row (but multiple columns) efficiently.
For example
IDVal IDDesc IdNum Id_Information_Type Attribute_1 Attribute_2 Attribute_3 Attribute_4 Attribute_5
23 asdc 1 Location USA NM ABQ Four Seasons 87106
23 asdc 1 Stats 2300 91.7 8.2 85432
23 asdc 1 Audit 1996 June 17 1200
65 affc 2 Location USA TX AUS Hilton 92305
65 affc 2 Stats 5510 42.7 46 9999
65 affc 2 Audit 1996 July 172 1100
where different attributes mean different thing for each Information_type.
For example for Information_Type=Location
Attribute_1 means Country
Attribute_2 means State and so on.
For example for Information_Type=Stats
Attribute_1 means Population
Attribute_2 means American Ethnicity percentage and so on.
I want to create a view that shows like below:
IDVal IDDesc IDNum Country State City Hotel ZipCode Population American% Other% Area Audit Year AuditMonth Audit Type AuditTime
23 asdc 1 USA NM ABQ FourSeasons 87106 2300 91.7 46 85432 1996 June 17 1200
65 affc 2 USA TX AUS Hilton 92305 5510 42.7 46 9999 1996 July 172 1100
ThanksHi,
That's called Pivoting . The forum FAQ has a section on this subject: {message:id=9360005}
I hope this answers your question.
If not, post your best attempt, along with a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data. (You did post the results you wanted, but they're very hard to read because they're not formatted. Use \ tags, as described in the forum FAQ, below.)
Explain, using specific examples, how you get the results you want from the data given.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0). This is always important, but especially so with pivots.
See the forum FAQ {message:id=9360002} -
Combine multiple rows in single row
I am new to SQL server and i am trying to combine multiple row in single row but i am not able to do it.Can anyone help me out?
Input :
Id |RED |BUY |BSW
1328 NULL NULL 0.05
1328 NULL 0.06 NULL
1328 0.01 NULL NULL
1328 0.05 NULL NULL
1329 NULL NULL 0.05
1329 NULL 0.05 NULL
1329 0.05 NULL NULL
Output
Id |RED |BUY |BSW
1328 0.01 0.06 0.05
1328 0.05 NULL NULL
1329 0.05 0.05 0.05Actually I am consolidating above result into text file and sending it to external system.Main aim is to remove NULL values and arrange the data as expected output.
Also expected output can be
Id |RED
|BUY |BSW
1328 0.05
0.06 0.05
1328 0.01
NULL NULL
Or
Id |RED
|BUY |BSW
1328 0.01
0.06 0.05
1328 0.05
NULL NULL
for Id= 1328. -
Hi
I have SPGridView control (fetching value from DB) with a column which is having multiple values
in single row seperated by ";", whenever filter applied it show these values in single row but i want
to dispaly these values separately in diff. rows when column filter is applied.
I have exactly same req. as mentioned in http://sadomovalex.blogspot.in/2011/03/spgridview-with-filtering-by-multiple.html
but this solution didn't work for me.
Please help/suggest.Hi Erland,
Thank you very much for the answer. Sorry I had to be more accurate on my XML : This XML is in a SQL Server Table column. This table also has an id column. It will be great if you can answer specifically to this.
<RootNode>
<Node1>
<Line_id_Node>1 </Line_id_Node>
<A>
<B>
<D>Val1 </D>
</B>
<B>
<D>Val2 </D>
</B>
<B>
<D>Val3 </D>
</B>
</A>
</Node1>
<Node1>
<Line_id_Node> 2 </Line_id_Node>
<A>
<B>
<D>Val4 </D>
</B>
<B>
<D>Val2 </D>
</B>
</A>
</Node1>
<Node1>
<Line_id_Node> 3 </Line_id_Node>
<A>
<B>
<D>Val5 </D>
</B>
</A>
</Node1>
</RootNode>
Expected O/P:
Line_id_Node Column_D
1 1
val1, val2, val3
2 2
val4, val2
3 3
val5
Nichesl -
Convert multiple rows into single rows for the respective index name
Dear Experts,
I want to convert multiple rows into single rows for the respective index name,
Here is my query.
SELECT user_tables.table_name, user_indexes.index_name, user_ind_columns.column_name
FROM user_tables
JOIN user_indexes on user_indexes.table_name = user_tables.table_name
join USER_IND_COLUMNS on USER_INDEXES.INDEX_NAME = USER_IND_COLUMNS.INDEX_NAME
where user_indexes.index_name not like '%PK%' AND user_ind_columns.column_name NOT LIKE '%SYS%'
ORDER BY user_tables.table_name,user_indexes.index_name;
Result of previous query
TABLE_NAME
INDEX_NAME
COLUMN_NAME
T1
IDX_ACCNTYPCFG1
ENABLE_SERVICE
T1
IDX_ACCTTYPCFG1
ACC_CODE
T1
IDX_ACCTTYPCFG1
ACCTYPE
T2
IDX_ACCTTYPCFGAPP1
ACCTYPE
T3
IDX_ACTLG1
MOBILE_NO
T3
IDX_ACTLG1
ID
Desired output required is
TABLE_NAME
INDEX_NAME
COLUMN_NAME
T1
IDX_ACCNTYPCFG1
ENABLE_SERVICE,ACC_CODE,ACCTYPE
T2
IDX_ACCTTYPCFGAPP1
ACCTYPE
T3
IDX_ACTLG1
ACCTYPE,MOBILE_NO
please help.Maybe
with
user_tables as
(select 'T1' table_name,'IDX_ACCNTYPCFG1' index_name,'ENABLE_SERVICE' column_name from dual union all
select 'T1','IDX_ACCTTYPCFG1','ACC_CODE' from dual union all
select 'T1','IDX_ACCTTYPCFG1','ACCTYPE' from dual union all
select 'T2','IDX_ACCTTYPCFGAPP1','ACCTYPE' from dual union all
select 'T3','IDX_ACTLG1','MOBILE_NO' from dual union all
select 'T3','IDX_ACTLG1','ID' from dual
select table_name,
case index_name when 'IDX_ACCNTYPCFG1' then 'IDX_ACCTTYPCFG1' else index_name end index_name,
listagg(case column_name when 'ID' then 'ACCTYPE' else column_name end,',') within group (order by null) column_name
from user_tables
group by table_name,case index_name when 'IDX_ACCNTYPCFG1' then 'IDX_ACCTTYPCFG1' else index_name end
TABLE_NAME
INDEX_NAME
COLUMN_NAME
T1
IDX_ACCTTYPCFG1
ACCTYPE,ACC_CODE,ENABLE_SERVICE
T2
IDX_ACCTTYPCFGAPP1
ACCTYPE
T3
IDX_ACTLG1
ACCTYPE,MOBILE_NO
Regards
Etbin -
Concatenation Multiple Rows into Single Row
My select query is like wise
ID Name
1 Arthi
2 Preethi
3 Madhu
4 Saranya
Above i listed all the names using the select query. Now i have to combine this 4 rows in single row like
Arthi,Preethi,Madhu,Saranya.
Also this rows may be 5 or 50 too. So what are Names listed using select statement those should combine into one Single String.
Help me plPlease post this in an appropriate forum;
SQL and PL/SQL
PL/SQL
Community Feedback and Suggestions (Do Not Post Product-Related Questions Here)
Adith -
Combining Multiple Rows into single row with multple columns
Hi Experts,
I have the following requirement, kindly help me.
I have data in my table like below.
ID NAME DEPT
1 Sam 10
1 Sam 20
2 alex 30
2 alex 40
2 alex 50
3 vinod 60
3 vinod 70
I want to show the same data into single row with dynamically generating columns for DEPT. I want show like below.
ID NAME DEPT1 DEPT2 DEPT3
1 Sam 10 20
2 alex 30 40 50
3 vinod 60 70
It's urgent requirement, kindly help me.
Thanks in advance.Right I've had my drink, so what was this "urgent" question then?
798616 wrote:
I have data in my table like below.
ID NAME DEPT
1 Sam 10
1 Sam 20
2 alex 30
2 alex 40
2 alex 50
3 vinod 60
3 vinod 70
I want to show the same data into single row with dynamically generating columns for DEPT. I want show like below.Dynamic numbers of columns eh! Tricky.
If you understand how SQL statements are executed it's along these lines...
1. Open Cursor
2. Parse SQL statement and determine columns
3. Bind in any input values
4. Fetch data
5. Bind out values to columns
6. Repeat step 3 until no more data
7. Close cursor
Now, you're expecting that you can determine the columns (step 2) from the fetched data (step 4 onwards). You can't. The SQL engine needs to know the expected columns before any data is fetched so, it can't base the number of columns on the data itself.
If you need that requirement, you would need to query the data first and build up a dynamic query based on the data and then execute that dynamically built query to fetch the data and pivot it into those columns, which means that you have queried the data twice. Not good practice and not good (or simple) coding.
What you're talking of doing is something that should be handled at the presentation/interface layer, not as part of the data fetch.
Typically these sorts of things are handled most easily in report generation/writer tools such as Oracle Reports, Business Objects etc. where they fetch the data from the database and then process it to format it on the display, pivoting the results as required.
It's not something that lends itself to be easily achieved in SQL. Yes, SQL can do pivoting of data quite easily, but NOT with a dynamic number of columns.
If you were to specify that there is a maximum number of columns that you could get (rather than wanting it dynamic), then you can do it simply in SQL with the max-decode method...
SQL> ed
Wrote file afiedt.buf
1 with t as (select deptno, ename, row_number() over (partition by deptno order by ename) as rn from emp)
2 --
3 select deptno
4 ,max(decode(rn,1,ename)) as ename1
5 ,max(decode(rn,2,ename)) as ename2
6 ,max(decode(rn,3,ename)) as ename3
7 ,max(decode(rn,4,ename)) as ename4
8 ,max(decode(rn,5,ename)) as ename5
9 ,max(decode(rn,6,ename)) as ename6
10 ,max(decode(rn,7,ename)) as ename7
11 ,max(decode(rn,8,ename)) as ename8
12 ,max(decode(rn,9,ename)) as ename9
13 ,max(decode(rn,10,ename)) as ename10
14 from t
15 group by deptno
16* order by deptno
SQL> /
DEPTNO ENAME1 ENAME2 ENAME3 ENAME4 ENAME5 ENAME6 ENAME7 ENAME8 ENAME9 ENAME10
10 CLARK KING MILLER
20 ADAMS FORD JONES SCOTT SMITH
30 ALLEN BLAKE JAMES MARTIN TURNER WARD
SQL> -
ALV - Multiple Rows into Single Row
I have a requirement to display the ALV output from CDHDR&CDPOS tables here in the output i have 15 columns( Fields ) any changes im displaying in report output ,but if there is same time multiple columns will change im displaying as individual record instead of that i need to show as single row.
in this output last three records have same time change but i have populated into three different columns i want to make it as SINGLE Row Record.
Thanks!!We don't need script task for this. Use TSQL in the datasource. Refer below example
DECLARE @TEMP TABLE(ID INT, [VALUE] NVARCHAR(30))
INSERT INTO @TEMP VALUES(1 , 'MAZ')
INSERT INTO @TEMP VALUES(1 , 'HON')
INSERT INTO @TEMP VALUES(1 , 'FOR')
INSERT INTO @TEMP VALUES(2 , 'JEEP')
INSERT INTO @TEMP VALUES(2 , 'CHE')
INSERT INTO @TEMP VALUES(3 , 'NIS')
INSERT INTO @TEMP VALUES(4 , 'GMC')
INSERT INTO @TEMP VALUES(4 , 'ACC')
INSERT INTO @TEMP VALUES(4 , 'LEX')
SELECT [id],
Stuff((SELECT ',' + [VALUE]
FROM @TEMP
WHERE [id] = a.[id]
FOR xml path('')), 1, 1, '') [VALUE]
FROM @TEMP a
GROUP BY [id]
Regards, RSingh -
Club Multiple rows into single row
Hi,
Iam facing this problem. Iam having this table client_details with columns as
client -- group -- group_code
1234 ------ X ------ code1
1234 ------ Y ------ code2
5555 ------ X ------ code3
5555 ------ Y
Now when I Query this table for a particular client, I require both the group_code for this client (it can be null also). But I require the result in a SINGLE row.
The group will be either X or Y only.
Can anyone help me out pls
tnx
Cheoops
SQL> select client, max(decode("GROUP", 'X', GROUP_CODE)) X, max(decode("GROUP", 'Y', GROUP_CODE)) Y from client_details group by client;
CLIENT X Y
1234 code1 code2
5555 code3 -
Is it possible to show a presentation on multiple Ipads at the same time?
I am running a presentation in a few months time and would like to mirror our presentation live on a number of Ipads at the same time. Currently we are most likely to use Prezi as the presentation format. Is this possible?
Many thanks,
EdAssuming all participants have an Internet connection, it appears to support conferencing, so I don't see why not. If you are looking to provide a wired connection for all of them, doubt it.
-
How to show three more than one row as single row
for example there are two tables employee and department.
emp id dept_id
101 1
101 2
101 3
Due to different dept id i am getting three rows for same emp id. Is there anwyay i can show one row and all three departments into one line.
output like this 101 1/2/3
Please help!
Thanks864470 wrote:
However, I am not getting any distinct values for that.Are you sying there are multiple records for same emp_id, dept_id combination? If so:
SQL> with t as (
2 select 101 emp_id,1 dept_id from dual union all
3 select 101,2 from dual union all
4 select 101,2 from dual union all
5 select 101,3 from dual
6 )
7 -- end of on-the-fly data sample
8 select emp_id,
9 rtrim(xmlagg(xmlelement(d,dept_id,'/').extract('//text()') order by dept_id),'/') dept_list
10 from t
11 group by emp_id
12 /
EMP_ID DEPT_LIST
101 1/2/2/3
SQL> with t as (
2 select 101 emp_id,1 dept_id from dual union all
3 select 101,2 from dual union all
4 select 101,2 from dual union all
5 select 101,3 from dual
6 )
7 -- end of on-the-fly data sample
8 select emp_id,
9 rtrim(xmlagg(xmlelement(d,dept_id,'/').extract('//text()') order by dept_id),'/') dept_list
10 from (
11 select emp_id,
12 dept_id
13 from t
14 group by emp_id,
15 dept_id
16 )
17 group by emp_id
18 /
EMP_ID DEPT_LIST
101 1/2/3
SQL> SY. -
Concatenate multiple rows into single row
Hi I need to concatenate multiple rows,
these are the rows I have
Name
Rnk
Northshore
1
F3
2
Borderline
3
Mattoon
3
Vinemane
5
Arizona
5
WestShore
5
Schumburg
5
Wilson
5
This is how I would like it to look
Name
Rnk
Northshore
1
F3
2
Borderline, Mattoon
3
Vinemane, Arizona, WestShore, Schumburg, Wilson
5
Thanks
LISA86I meant is there a way to do it without using a table?
LISA86
We have not used any extra table. Ok, Try the below:
Select distinct
names= REPLACE(
Select a.Name as [data()]
From YOURTABLENAME A
Where A.Rnk = b.Rnk
Order by a.Name
FOR XML PATH ('') ), ' ', ',') ,Rnk
From YOURTABLENAME B Order by Rnk -
Data Federator: Unioning Multiple Tables into single view possible?
Hi,
I have three different databases with tables containing a portion of the same kind of data and I want to union the three different tables together in Data Federator to present a single logical view that has the complete set of data. Is this possible in Data Federator? How would I go about doing that?
Note: I do not have keys to join the tables together on since it's not simply extending the data in one table with additional data in another table and doing an inner join on a unique key. Instead, for example, there's a customer table for Finance, a customer table for Operations and a customer table for Sales and they all contain the same columns (with maybe slightly different names) and same type of data. I want to effectively union Finance, Operations and Sales together in a federated/virtualized view so applications can just query from that view to get all the customers from the three different databases.
I have been unable to do this so far since Data Federator requires each table in a mapping to have a relationship with the other tables in the mapping.
Thanks for the help.
KerbyI figured out the original question using one mapping for each table but have a new question now.
Is it possible for an application to use the combined view from Data Federator to write back into the databases?
e.g. have an application use the target table in Data Federator and view the results, and based on that update the data in the underlying database that provides the data for the target table?
Thanks for the help.
Kerby -
Hi friends,
I have one table like:
10 SAM
10 CAN
10 MAN
10 DEV
20 MAL
And want output like:
10 SAM,CAN,MAN,DEV
20 MAL
i want to combine multiple rows into one within an existing view.
What query will suit this to get this type of output.Please refer to this thread
column values separated by ,
Maybe you are looking for
-
Apps from Ipod Touch won't start
Hello everyone, Since about a day and a half I have been having problems with my Ipod Touch. All of the apps I got via the App store fail to start up. That is, they start up, the opening screen of the app quickly flashes and I am returned to the home
-
Problems re-installing Leopard after hardrive reformat
My hard drive had an invalid sibling link and it was about to be passed on to another user. I decided the easiest way to fix the problem was to reformat and do a fresh install. I decided to be thorough and used a seven pass erase. I let that run over
-
Hi SDN's, Is it possible to use a standalone WAS 6.40 (ABAP component) for integrating EP 6.0 with R3 4.6C and older? If not why isn't it possible? I know ITS 6.20 works for this. Our client wants to integrate EP 6.0 with 4.6C for MSS/ESS fucntionali
-
LIS Extractor (LE Shippments) Direct Delta, no queue visible
Hi gurus, I am new in data extraction and I have the following problem: I am trying to set up the datasouces for deliveries (application 12) through the cockpit. I have set the update mode to Direct Delta, I have deleted the setup tables, then perfor
-
Problem deploying Software InstallationGPO in AGPM 4
I can create a controlled GPO, Check Out, edit, create a software installation GPO, and CheckIN, When I attempt to Deploy or Check out a second time to edit the GPO I receive the following error: Check Out GPO: Test Application GPO...Failed The overa