Displaying records in one row??
The Board table has the following columns Userrecordid,Board_codes and the data is being displayed as:
Here is the data in the Boards Table:
Userrecordid Board_codes Board_Number
m001 KBIM A1234
m001 PBIM B1234
m002 PBIM Dytu1
m003 PBIM io34I had written a query(splitting KBIM code data & PBIM code data which actually brought back results as seen below:
KBIM (Y/N) KBIM # PBIM (Y/N) PBIM #
Y A1234 NULL NULL
NULL NULL Y B1234I need to display the above results in one row shown as below:
KBIM (Y/N) KBIM # PBIM (Y/N) PBIM #
Y A1234 Y B1234
Hi,
francislazaro wrote:
The Board table has the following columns Userrecordid,Board_codes and the data is being displayed as:
Here is the data in the Boards Table:
Userrecordid Board_codes Board_Number
m001 KBIM A1234
m001 PBIM B1234
m002 PBIM Dytu1
m003 PBIM io34...
I need to display the above results in one row shown as below:
KBIM (Y/N) KBIM # PBIM (Y/N) PBIM #
Y A1234 Y B1234
So you don't want anything in the results about userrecordids 'm002' and 'm003', because they do not have both board_codes 'KBIM' and 'PBIM', is that it?
One way to get those results is a self-join, as if all the rows with borad_code 'KBIM' were in one table, and all the rows with borad_code 'PBIM' were in another:
SELECT 'Y' AS "KBIM (Y/N)"
, k.boradnumber AS "KBIM #"
, 'Y' AS "PBIM (Y/N)"
, k.boradnumber AS "KBIM #"
FROM boards k
JOIN boards p ON k.userrecordid = p.usrrecordid
WHERE k.board_codes = 'KBIM'
AND p.board_codes = 'PBIM'
;Another way is a GROUP BY, like Mpautom suggested.
If your requirements change in the future, so that you need to include all rows, even if they don't have both board_codes, then you could change the JOIN to a FULL OUTER JOIN and make what I wrote as the WHERE clause part of the join condition, but I suspect the GROUP BY approach would be more efficient in that case.
Similar Messages
-
Query below is returning data in multiple rows, I want to display them as one row:
select
event_id,
data_type_cd,
quantity
from Event,Data_types
where event_id = 1234
and event.DATA_TYPE_ID = data_types.DATA_TYPE_ID
(I want to display data_type_cd concatenated with quantity as every code had different quantity)> Sample data is:
> Data_type_id Quantity
> ------------------ ----------
> 1 34
> 2 67
> 15 35
> 20 23
> I want to display as:
> 1 34 2 67 15 35 20 23
if you want all the rows in one column see this given example below:
SQL> select t.*
2 from (select 1 data_type_id, 34 quantity from dual union all
3 select 2 data_type_id, 67 quantity from dual union all
4 select 15 data_type_id, 35 quantity from dual union all
5 select 20 data_type_id, 23 quantity from dual) t;
DATA_TYPE_ID QUANTITY
1 34
2 67
15 35
20 23
SQL> select substr(sys_xmlagg(xmlelement(col, ' ' || data_type_id||' '||quantity)).extract('/ROWSET/COL/text()').getclobval(), 2) new_disp
2 from (select 1 data_type_id, 34 quantity from dual union all
3 select 2 data_type_id, 67 quantity from dual union all
4 select 15 data_type_id, 35 quantity from dual union all
5 select 20 data_type_id, 23 quantity from dual) t;
NEW_DISP
1 34 2 67 15 35 20 23
SQL> -
Self join to get related records in one row
I have a table that has individual records for each family member.
tPerson.LastName, tPerson.FirstName, tPerson.RelationshipCode, tPerson.FamilyUnitCode, tPerson.JobCode
Smith, John,HD, 1234, AD
Smith, Jill, SP, 1234, TC
Olson, Fred, HD, 2345, AV
Olson, Wilma, SP, 2345, MD
Adams, Nate, HD, 3456, DP
Adams, Heidi, SP, 3456, DP
Franks, John, HD, 4567, AV
Williams, Pauline, HD, 5678, TC
I need to get each family unit in one row, preferably without a group on, for a report because I need to compare the jobcodes of HD and SP to decide how to build an expression for a listing. I need to also get singles with no spouse info.
FamilyCode, Lastname, HDFirstName, SPFirstName, HDJobCode, SPJobCode
1234, Smith, John, Jill, AD, TC
2345, Olson, Fred, Wilma, AV, MD
3456, Adams, Nate, Heidi, DP, DP
4567, Franks, John, NULL, AV, NULL
5678, Williams, Pauline, NULL, TC, NULL
Does the type on constraint affect the effect of an inner join? I have trouble getting the left side returning rows where there is no SP records for that familyCode.
Any help? John>> I have a table that has individual records [sic] for each family member. <<
Rows are not records. And you posted no DDL.
Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying
temporal data. We need to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for:
https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
The sample data looks like it has a tibble on it. This is the classic design error of putting meta data, like a “t-” on tables and data element names. The next classic error you made
is a table name that is singular and vague; do you really have only one “Person” in a table? According to ISO-11179 rules, that is what you said.
>> I need to get each family unit in one row, ..<<
Not in RDBMS. Please look up the term “1NF” or “First Normal Form” which forbids structure data in columns.
But it just gets worse. Being in a family is a relationship, so it has its own table. The individuals are entities, so they have a table. Having a job is another relationship, so it is
in a third table. In your world, all these things are crammed into a single table! This might be how an OO programmer would attempt to do RDBMS that first time, but it is not good. Here is skeleton to get your started:
CREATE TABLE Personnel
(emp_id CHAR(9) NOT NULL PRIMARY KEY,
last_name VARCHAR(20) NOT NULL,
first_name VARCHAR(20) NOT NULL);
CREATE TABLE Family_Units
(family_unit CHAR(4) NOT NULL,
relationship_code CHAR(5) NOT NULL
CHECK (relationship_code IN ('spouse', ????)),
PRIMARY KEY (family_unit, relationship_code),
emp_id_1 CHAR(9) NOT NULL
REFERENCES Personnel
ON DELETE CASCADE,
emp_id_2 CHAR(9) NOT NULL
REFERENCES Personnel
ON DELETE CASCADE,
CHECK (emp_id_1 <> emp_id_2)
CREATE TABLE Employment
(emp_id_1 CHAR(9) NOT NULL
REFERENCES Personnel
ON DELETE CASCADE PRIMARY KEY,
job_code CHAR(2) NOT NULL); -- do you know about DOT codes?
See how we use DRI actions? Etc.
>> I need to compare the job_codes of HD and SP to decide how to build an expression [sic] for a listing. I need to also get singles with no spouse info. <<
Expression return scalar values in SQL. You meant query. Where is the SQL you attempted? Is “spouse” the only relationship?
You have not posted enough information for anyone to really help you. What little we can extract from this says that you have no idea how about RDBMS. Want to do some reading, follow
Netiquette and try again?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Displaying data in one row for for 2 tables without relaiton
I Have 2 tables without any relation and there is a common field and i want to display data like below
table refdet
1)
refdt----------refbr----refamt----refcat
10-aug-09---10-----34234-----101a
10-aug-009--11----23245-----102a
1-AUG-09----10----455.98----104A
19-aug-09-12-----10000-------103B
2) brdet
trdt---------brn-----brtot-----------brcat
11-aug09--10-----454000-------A
09-aug-09-12-----550000-------B
30-sep-09--10-----430000------A
09-aug-09-11-----550000-------B
i want to display data for each branch refdet.refbr = brdet.brn
refdet
Br10
refdt----------refbr----refamt----refcat-----trdt---------brn-----brtot-----------brcat
10-aug-09---10-----34234-----101a-------11-aug09--10-----454000-------A
1-AUG-09----10----455.98----104A------30-sep-09--10-----430000------A
Br 11
10-aug-009--11----23245-----102a -------09-aug-09-11-----550000-------B
Br12
19-aug-09-12-----10000-------103B------09-aug-09----12-----550000-------B
i tried the following query but its not working
select distinct null as refdt,null as refbr,null as refamt,null as refcat,b.trdt,b.brn,b.brtot,b.brcat
from brdet a,refdet b
where a.refbr (+) = b.brn
union all
select distinct a.refdt,a.refbr,a.refamt,a.refcat,null as trdt,null as brn,null as brtot,null as brcat
from brdet a,refdet b
where a.refbr = b.brn (+)
its not giving the records on each row for both side its creating separte rows for each records in both table.
rgds
jytohi
-Hi jytohi,
Please lean back for a moment and study your question. Ask yourself, is this a reasonable way to ask a question?
Jopefully you'll reach the answer, "No it isn't, I need to.."
1. Turn these
1)
refdt----------refbr----refamt----refcat
2) brdet
trdt---------brn-----brtot-----------brcatinto CREATE TABLE statements.
2. Turn these
10-aug-09---10-----34234-----101a
10-aug-009--11----23245-----102a
1-AUG-09----10----455.98----104A
19-aug-09-12-----10000-------103B
11-aug09--10-----454000-------A
09-aug-09-12-----550000-------B
30-sep-09--10-----430000------A
09-aug-09-11-----550000-------Binto INSERT INTO statements
3. Turn this
refdet
Br10
refdt----------refbr----refamt----refcat-----trdt---------brn-----brtot-----------brcat
10-aug-09---10-----34234-----101a-------11-aug09--10-----454000-------A
1-AUG-09----10----455.98----104A------30-sep-09--10-----430000------A
Br 11
10-aug-009--11----23245-----102a -------09-aug-09-11-----550000-------B
Br12
19-aug-09-12-----10000-------103B------09-aug-09----12-----550000-------Binto properly formatted expected output, along with a reasonable explanation of why
4. Turn this
select distinct null as refdt,null as refbr,null as refamt,null as refcat,b.trdt,b.brn,b.brtot,b.brcat
from brdet a,refdet b
where a.refbr (+) = b.brn
union all
select distinct a.refdt,a.refbr,a.refamt,a.refcat,null as trdt,null as brn,null as brtot,null as brcat
from brdet a,refdet b
where a.refbr = b.brn (+)into a properly formatted query
And last, put everything in into curly brackets {noformat}{noformat} to preserve formatting and blank space.
Best regards
Peter -
Hi all,
I want to display all the party codes which have same party name,
and I want to display all the party codes in one row separated by comma. is it possible?You can either use analytic functions + hierarchy or stragg (listagg if you are on 11.2) or undocumentd wm_concat. There are plenty examples on this forum. For example:
select deptno,
ltrim(sys_connect_by_path(job,','),',') job_list
from (
select deptno,
job,
row_number() over(partition by deptno order by job) rn
from emp
where connect_by_isleaf = 1
start with rn = 1
connect by deptno = prior deptno
and rn = prior rn + 1
DEPTNO JOB_LIST
10 CLERK,MANAGER,PRESIDENT
20 ANALYST,ANALYST,CLERK,CLERK,MANAGER
30 CLERK,MANAGER,SALESMAN,SALESMAN,SALESMAN,SALESMAN
select deptno,
rtrim(stragg(job || ','),',') job_list
from emp
group by deptno
DEPTNO JOB_LIST
10 MANAGER,PRESIDENT,CLERK
20 CLERK,ANALYST,CLERK,ANALYST,MANAGER
30 SALESMAN,MANAGER,SALESMAN,SALESMAN,CLERK,SALESMAN
select deptno,
wm_concat(job) job_list
from emp
group by deptno
DEPTNO JOB_LIST
10 MANAGER,PRESIDENT,CLERK
20 CLERK,ANALYST,CLERK,ANALYST,MANAGER
30 SALESMAN,MANAGER,SALESMAN,SALESMAN,CLERK,SALESMANSY. -
Multiple record in one row..
Hi experts,
I want to merge multiple row from same table into one row... is it possible? if so then how??
Regards,
SKPSure, it's possible
create table scott.a
as
select 1 a, 2 b from dual
union all
select 3 a, 4 b from dual
create table scott.b
(a number, b number, c number, d number)
insert into scott.b
select a1.a,a1.b,a2.a,a2.b from scott.a a1, scott.a a2
where a1.a = 1 and a2.a = 3
P.S. Sorry, at first misunderstood the task
Message was edited by:
Dmytro Dekhtyaryuk -
Hi I need to avoid extracting the Ids multiple times. That is display first Id for the receipt_no as Primary Id and display the next ocurring ones as associate Ids in one line. There could be more than one associate Ids with one receipt. Any help appreciated.
Sample Query as below:
SELECT DISTINCT gift_id,receipt, asssociate_donor_id, associate_donor
from g2
LEFT OUTER JOIN (SELECT DISTINCT gift_id asssociate_donor_id
,receipt_number
,e2.name AS associate_donor
FROM X
JOIN advance.entity e2 ON (e2.id_number = gift_donor_id)
WHERE
AND receipt_date >=
to_date('01/01/2000'
,'dd/mm/yyyy')) g4 ON (g2.gift_id !=
asssociate_donor_id AND
g2.receipt =
g4.receipt_number )
Sample table
Id receipt_no cash
1 101 $100
2 101 $100
3 102 100
Sample Expected Result:
1, 101, 2, Mark
3, 102
Many ThanksYou didn't really provide enough data to arrive at your expected output, so I took the liberty of creating some. If my data do not match yours, perhaps you'll provide yours and we can give you a better answer....
WITH receipts AS
( SELECT 1 gift_id, 101 receipt_id, 201 gift_donor_id, 100 amt FROM DUAL
UNION ALL SELECT 2, 101, 202, 100 FROM DUAL
UNION ALL SELECT 3, 102, 203, 100 FROM DUAL )
, donors AS ( SELECT 201 AS donor_id, 'Matthew' donor_name FROM DUAL
UNION ALL SELECT 202, 'Mark' FROM DUAL
UNION ALL SELECT 203, 'Luke' FROM DUAL)
, g2 AS ( SELECT receipts.*, row_number() OVER ( PARTITION BY receipt_id ORDER BY gift_id ) gift_ordering
FROM receipts )
, donations as ( SELECT gift_id, receipt_id
FROM g2
WHERE gift_ordering = 1 )
, assocs AS ( SELECT receipt_id , donor_name , COUNT(*) assoc_cnt
FROM g2 JOIN donors ON ( gift_donor_id = donor_id )
WHERE gift_ordering > 1
GROUP BY receipt_id , donor_name)
SELECT donations.gift_id
, donations.receipt_id
, assocs.assoc_cnt + 1 total_donors_on_receipt
/* will be NULL if only one donor */
, assocs.donor_name
FROM donations
LEFT JOIN assocs ON ( donations.receipt_id = assocs.receipt_id )And the output...
GIFT_ID RECEIPT_ID TOTAL_DONORS_ON_RECEIPT DONOR_N
1 101 2 Mark
3 102
2 rows selected.I hope this helps, or at least points you in the right direction. -
How can I DISPLAY MORE THAN ONE ROW OF PHOTOS WHEN CREATING A BOOK?
Can I display more than A SINGLE ROW of ohotos on the right side of the page when I am creating a photo book? I have 500 pics and this single bar is ridiculous.
Command (right) - click on a photo in the Photo tray and select Small Photo from the contextual menu:
This will give you two columns of photos.
To reduce the number of photos to select from one can select only Unplaced Photos to be displayed in the tray.
Happy Holidays -
How to get multiple records in one row and different column
Hi All,
I am using oracle database 11g
and i have a two tables table_1, table_2
table_1 having columns
emp_no
first_name
middle_name
last_name
email
and table_2 having columns
emp_no
phone_type
phone_number
and having entires
emp_no phone_type phone_number
1001 MOB 9451421452
1001 WEMG 235153654
1001 EMG 652341536
1002 MOB 9987526312
1003 WEMG 5332621456
1004 EMG 59612356
Now i want the output of values with phone type as MOB or WEMG in a single row with different columns
emp_no first_name middle_name last_name email mobile officeno
1001 mark null k [email protected] 9451421452 235153654
1002 john cena gary [email protected] 9987526312 null
1003 dany null craig [email protected] null 5332621456
1004 donald finn sian [email protected] null null
can i have any inputs to achive this???
Regards
$sidFrank Kulash wrote:
sonething like this:Frank, you missed aggregate function (pivot requires one). However main thing is it will cause ORA-01748:
with table_1 as (
select 1001 emp_no,'mark' first_name,null middle_name,'k'last_name,'[email protected]' email from dual union all
select 1002,'john','cena','gary','[email protected]' from dual union all
select 1003,'dany',null,'craig','[email protected] null' from dual union all
select 1004,'donald','finn','sian','[email protected]' from dual
table_2 as (
select 1001 emp_no,'MOB' phone_type,9451421452 phone_number from dual union all
select 1001,'WEMG',235153654 from dual union all
select 1001,'EMG',652341536 from dual union all
select 1002,'MOB',9987526312 from dual union all
select 1003,'WEMG',5332621456 from dual union all
select 1004,'EMG',59612356 from dual
SELECT *
FROM table_1 t1
JOIN table_2 t2 ON t1.emp_no = t2.emp_no
PIVOT ( max(t2.phone_number)
FOR t2.phone_type IN ( 'MOB' AS mob
, 'WEMG' AS wemg
FOR t2.phone_type IN ( 'MOB' AS mob
ERROR at line 19:
ORA-01748: only simple column names allowed hereYou need to:
with table_1 as (
select 1001 emp_no,'mark' first_name,null middle_name,'k' last_name,'[email protected]' email from dual union all
select 1002,'john','cena','gary','[email protected]' from dual union all
select 1003,'dany',null,'craig','[email protected] null' from dual union all
select 1004,'donald','finn','sian','[email protected]' from dual
table_2 as (
select 1001 emp_no,'MOB' phone_type,9451421452 phone_number from dual union all
select 1001,'WEMG',235153654 from dual union all
select 1001,'EMG',652341536 from dual union all
select 1002,'MOB',9987526312 from dual union all
select 1003,'WEMG',5332621456 from dual union all
select 1004,'EMG',59612356 from dual
table_3 as (
select t1.emp_no,first_name,middle_name,last_name,email,
phone_type,phone_number
FROM table_1 t1
LEFT JOIN table_2 t2 ON t1.emp_no = t2.emp_no
SELECT *
FROM table_3
PIVOT ( max(phone_number)
FOR phone_type IN ( 'MOB' AS mob
, 'WEMG' AS wemg
EMP_NO FIRST_ MIDD LAST_ EMAIL MOB WEMG
1004 donald finn sian [email protected]
1003 dany craig [email protected] null 5332621456
1001 mark k [email protected] 9451421452 235153654
1002 john cena gary [email protected] 9987526312
SQL>SY. -
Is it possible to display record detail across and down?
I am using forms Developer 10.1.2.0.2
Is it possible to display record detail across and down? I would like to create a simple form that displays records from one column in one table. This table has many records, so I would like the data to be displayed in two directions, as is possiblie in Reports Developer. In other words, have 3 columns with 5 rows all displaying the same column from the same table. Ex:
code1 code6 code11
code2 code7 code12
code3 code8 code13
code4 code9 code14
code5 code10 code15
FYI - the main reason I want to do this is to create a fancy form that is an LOV. I plan to have each column next to a check box. Currently, we have the column next to a check box, but with only one column the user has to do too much scrolling to get to see the various codes.
Edited by: E Slazyk on Apr 22, 2009 1:43 PMIt seems programmatically possible...
You could do a JSON product dump and tie codes to url's, then tie this to an autocomplete search bar with a click through or delayed auto navigation...
http://jqueryui.com/autocomplete/#remote-jsonp
I hope this helps.
@webmosphere
www.webmosphere.co.uk -
Displaying more than one column in TreeControl
Hi,
I have three tables ( LaborOperation, LaborIndex, LaborData). In TreeControl, i am displaying the following table columns,
LaborOperation ->operationid,
LaborIndex -> indexid,
LaborData -> date, value.
i want to be like this.
+ Operation Id(Single Column)
+ OperationIndex(Single Column)
-OperationData(Multiple Column)
I can able to display single column values in tree control by setting the nodedifinition property in tree control. i can't able to display more than one column in tree control.
any idea about this problem
thanks in advance.
-NainarArun Prasath wrote:
I want to display more than one row in a multiple columns of a single row.
For example,
In oracle apps, there are multiple tax lines for a single invoice. Each tax lines having their own entry in tax detail table.
When i try to display a single invoice's details in a single row i found the difficulty.Hmm did you see the title of the forum? Oracle Database » General Questions !
May be you want to check the Oracle Apps forum?
Aman.... -
How to display selected records on one HTML page?
Hi,
I would like to display selected part of records on one page in HTML region. For example I have a Master - Detail table set named Procedures and Tasks (each Procedure can have one or more tasks)
I would like to be able to display all Tasks for a given Procedure in one HTML region on a page... The problem is that the number of tasks vary between procedures and can change in time. Also, the 'task description' can be very large so a simple report list of all tasks is something I cannot use... (I would like eg for the task name to be here, and the task_description to be there - unlike the report where everything is in one line...) The following are my ideas but non of them seemed to be feasable here...
1. Use a report based on vertical columns (However I am using Theme 10 for which there are no vertical column templates. The only vertical templates I can see are the default ones but I have no idea how to customize them - where are they?)
2. In HTML region use &ITEM_NAME. substitutions. In order to display more than one &EMN_NAME. (based on eg. EMPID) I suspect that I would need to write some kind of javascript loop. Has anyone have an idea about how would such a script look like?
3. Display each Task in a separate screen. This is something I would want least but better than nothing - to have a customized report which would display one task at a time with some kind of pagination to it...
Please let me know if someone has tried something simmilar or maybe there is a 4th option which will be simpler and easier...
Many thanks,
Pawel.
I tried to make a very simple illustration of what I would like to achive here:
http://htmldb.oracle.com/pls/otn/f?p=44995:3:9461299983704828937::::
Message was edited by:
padmochoJust to answer this one myself....
In order to achive the above I used a PL/SQL Dynamic Content page and entered a html content in htp.prn('');
Then, I created a PL/SQL LOOP which searches through the various rows...
In the end, whenever I wanted to display html content I just used htp.prn and for variables I used htp.p(<var_name>);
Maybe, it helps ;) -
Return more than one row to display as text?
I don't know if this is possible or not. I'd rather not create a report for one item.
is there a way to allow a display as text filed show more than one item from a query? I've tryed several things none work. I have one field that I'd like to show multiple data as just text. but everything I try displays one row only in the field. is there a way around this?Nazdev,
If you're trying to display multiple records as separate parts (not just concatenated together), the easiest solution would be a report. If you just want to append values together and present them in a single item, you should be able to create a query to build your string pretty easily, though you might need to write an Oracle function to do the concatenation for you.
I wrote a function to do that a while back, obvious you should check it thoroughly before you use it.
CREATE OR REPLACE FUNCTION cursor_to_list(cur_in IN aeo_misc_tools.string_ref_cur,
delimiter_in IN VARCHAR2 := ', ',
max_len_in IN PLS_INTEGER := 32000,
more_string_in IN VARCHAR2 := 'More...') RETURN VARCHAR2 IS
Description: Given single-column ref cursor, return values separated
by delimiter parameter value.
Trim last trailing delimiter.
Parameters: cur_in - opened cursor w/ single string column
delimiter_in - separate values w/ this, defaults to comma-space
max_len_in - maximum returned length
more_string_in - Append if length would be longer than max_len_in
Returns: String of separated values
Author: Stew Stryker
Usage: children_list := cursor_to_list(cur_in => child_cur, delimiter_in => ' | ');
Note: Can also pass a cursor to this directly, using the CURSOR clause, as follows:
children_list := cursor_to_list(CURSOR(SELECT pref_mail_name FROM children
WHERE parent_id = '0000055555' ORDER BY dob),
delimiter_in => ' | ');
TYPE single_string_rec_t IS RECORD(
string_val VARCHAR2(256));
TYPE string_ref_cur IS REF CURSOR;
row_value single_string_rec_t;
ret_list VARCHAR2(32000);
more_string VARCHAR2(256) := NVL(more_string_in, ' ');
delim_len CONSTANT PLS_INTEGER := LENGTH(delimiter_in);
more_len CONSTANT PLS_INTEGER := LENGTH(more_string_in);
max_len PLS_INTEGER := max_len_in - more_len - delim_len;
BEGIN
IF max_len > 0
THEN
IF cur_in%ISOPEN
THEN
FETCH cur_in
INTO row_value;
WHILE cur_in%FOUND
LOOP
IF NVL(LENGTH(ret_list), 0) + NVL(LENGTH(row_value.string_val), 0) + delim_len <=
max_len
THEN
ret_list := ret_list || row_value.string_val || delimiter_in;
ELSIF INSTR(NVL(ret_list, ' '), more_string) = 0
AND NVL(LENGTH(row_value.string_val), 0) > 0
THEN
ret_list := ret_list || more_string;
END IF;
FETCH cur_in
INTO row_value;
END LOOP;
-- Strip last delimiter
ret_list := RTRIM(ret_list, delimiter_in);
CLOSE cur_in;
END IF;
END IF;
RETURN ret_list;
EXCEPTION
WHEN no_data_found THEN
RETURN ret_list;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('EXCEPTION IN aeo_misc_tools.cursor_to_list - ' || TO_CHAR(SQLCODE) || ': ' ||
SQLERRM);
RAISE;
RETURN ret_list;
END cursor_to_list;Good luck,
Stew -
How to print one record in differnt row in ALVGrid
Hi,
I have request in ALV report development.
Ex: i have a row in that 10 field. so i want to print 5 fields in one row, 3 fields in one row and 2 fields 3 row.. like that it shold print all the records.
Please suggest me, what is the logic ALV Grid.
thanks and records,
JP reddy.Hi,
Herewith i am sending the sample code for the report.
*& Report YMS_SUBHEADINGALV2 *
REPORT YMS_SUBHEADINGALV2.
TYPE-POOLS : SLIS.
TYPES : BEGIN OF YVBRK_LIST,
VBELN LIKE VBRK-VBELN,
FKART LIKE VBRK-FKART,
BELNR LIKE VBRK-BELNR,
END OF YVBRK_LIST.
TYPES : BEGIN OF YVBRP_LIST,
VBELN LIKE VBRP-VBELN,
POSNR LIKE VBRP-POSNR,
NETWR LIKE VBRP-NETWR,
END OF YVBRP_LIST.
DATA: I_VBRK TYPE STANDARD TABLE OF YVBRK_LIST
INITIAL SIZE 0 WITH HEADER LINE.
DATA: I_VBRP TYPE STANDARD TABLE OF YVBRP_LIST
INITIAL SIZE 0 WITH HEADER LINE.
DATA: KEY_INFO TYPE SLIS_KEYINFO_ALV,
REPORT_ID LIKE SY-REPID,
TABLE_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
G_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
G_TOP_OF_LIST TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST'.
INITIALIZATION.
REPORT_ID = SY-REPID.
KEY_INFO-HEADER01 = 'VBELN'.
KEY_INFO-ITEM01 = 'VBELN'.
KEY_INFO-HEADER02 = SPACE.
KEY_INFO-ITEM02 = 'NETWR'.
GS_LAYOUT-GROUP_CHANGE_EDIT = 'X'.
GT_SORT-FIELDNAME = 'VBELN'.
GT_SORT-TABNAME = '1'.
GT_SORT-SPOS = 1.
GT_SORT-UP = 'X'.
GT_SORT-SUBTOT = 'X'.
GT_SORT-GROUP = '*'.
APPEND GT_SORT.
GT_SORT-FIELDNAME = 'POSNR'.
GT_SORT-TABNAME = '2'.
GT_SORT-SPOS = 2.
GT_SORT-UP = 'X'.
GT_SORT-SUBTOT = 'X'.
GT_SORT-GROUP = ''.
APPEND GT_SORT.
TABLE_FIELDCAT-FIELDNAME = 'VBELN'.
TABLE_FIELDCAT-seltext_m = 'Sales Document'.
TABLE_FIELDCAT-TABNAME = '1'.
TABLE_FIELDCAT-COL_POS = '1'.
TABLE_FIELDCAT-OUTPUTLEN = 17.
TABLE_FIELDCAT-DO_SUM = ' '.
APPEND TABLE_FIELDCAT.
TABLE_FIELDCAT-FIELDNAME = 'POSNR'.
TABLE_FIELDCAT-seltext_m = 'Sales Document Item'.
TABLE_FIELDCAT-TABNAME = '2'.
TABLE_FIELDCAT-COL_POS = '1'.
TABLE_FIELDCAT-OUTPUTLEN = 14.
TABLE_FIELDCAT-DO_SUM = ' '.
APPEND TABLE_FIELDCAT.
TABLE_FIELDCAT-FIELDNAME = 'NETWR'.
TABLE_FIELDCAT-seltext_m = 'Net value'.
TABLE_FIELDCAT-TABNAME = '2'.
TABLE_FIELDCAT-COL_POS = '2'.
TABLE_FIELDCAT-OUTPUTLEN = 15.
TABLE_FIELDCAT-DO_SUM = 'X'.
APPEND TABLE_FIELDCAT.
PERFORM EVENTTAB_BUILD USING GT_EVENTS[].
START-OF-SELECTION.
SELECT VBELN
FKART
BELNR
INTO CORRESPONDING FIELDS OF TABLE I_VBRK
FROM VBRK
WHERE VBELN > '0090000121' AND VBELN < '0090000135'.
SELECT VBELN
POSNR
NETWR
INTO CORRESPONDING FIELDS OF TABLE I_VBRP
FROM VBRP
FOR ALL ENTRIES IN I_VBRK
WHERE VBELN = I_VBRK-VBELN.
PERFORM WRITE_REPORT.
*& Form EVENTTAB_BUILD
text
-->RT_EVENTS text
FORM EVENTTAB_BUILD USING RT_EVENTS TYPE SLIS_T_EVENT.
"Registration of events to happen during list display
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = RT_EVENTS.
READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE G_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO RT_EVENTS.
ENDIF.
ENDFORM. "EVENTTAB_BUILD
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
DATA: LS_LINE TYPE SLIS_LISTHEADER.
Header Data
REFRESH GT_LIST_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-INFO = 'Hierarchical Lists'.
APPEND LS_LINE TO GT_LIST_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM. "TOP_OF_PAGE
*& Form write_report
text
FORM WRITE_REPORT.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPORT_ID
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = TABLE_FIELDCAT[]
IT_SORT = GT_SORT[]
IT_EVENTS = GT_EVENTS[]
I_TABNAME_HEADER = '1'
I_TABNAME_ITEM = '2'
I_STRUCTURE_NAME_HEADER = 'YVBRK_LIST'
I_STRUCTURE_NAME_ITEM = 'YVBRP_LIST'
IS_KEYINFO = KEY_INFO
TABLES
T_OUTTAB_HEADER = I_VBRK
T_OUTTAB_ITEM = I_VBRP.
ENDFORM. "write_report
Thanks,
Shankar -
Hello ---
I have an array of data, I would like to be displayed all the data in one row.<tr></tr>, how to do this?
If I use <h:table> <column></column></h:table>, it will display different rows.
Thanks!
BenPopulate the components in the backingbean. Try something like:
JSF<h:panelGrid binding="#{myBean.grid}" />MyBeanprivate List arrayOfData;
private HtmlPanelGrid grid; // + getter + setter
private void populateGrid() {
grid = new HtmlPanelGrid();
grid.setColumns(arrayOfData.size());
for (Iterator iter = arrayOfData.iterator(); iter.hasNext();) {
Object value = iter.next();
HtmlOutputText text = new HtmlOutputText();
text.setValue(value);
grid.getChildren.add(text);
}
Maybe you are looking for
-
List of pending GR's without excise capturing
Dear Expertise, Dear Experts, I need a list of GR documents which are pending for excise capturing. we do process like after getting receipts ..MIGO/MIRO/J1ig,,if i forgot J1IG after migo ,how to find the missing GR documents ? and i heard a report j
-
Music library after data recovery - ID3 tags all over the place
Hi, For a short time there i was using my external drive as my music library, while i sorted enough space ot run it from C: However, that didn't last long and i was asked if i wanted to reformat the drive. Using Easeus I was able to recover the mp3s.
-
What's wrong with AWT cursors on Windows Vista?
I'm getting a weird problem on Windows Vista as I'm trying to create custom cursors in AWT -- the ones you create with the createCustomCursor() function in java.awt.Toolkit, that is. The problem is that their hotspot point is offset quite a few pixel
-
Hi Experts, Cuurently i am working on Synchronous scenario. My scenario is ABAP Client Proxy> PI>AXIS SOAP ADAPTER(Webservice). My client requirement is to use UsernameToken security with PasswordDigest. I have deployed all the relevant .jar files a
-
TS1363 How can I reset my contacts on ny iphone 4,s
hom can I chage the settings on my contacts of iphone