Merging data in table rows into single page form to be printed?
Hello all,
I've been trying to make this work but after much hair pulling have had no luck with it.
I have a three page pdf. On the first page are two tabls of employee names. Each row in the tables includes a cell for the employee name and also one that holds a checkbox.
The second and third pages are time sheets appropriate for the department that each employee is in. These two pages are hidden.
So the idea is that if a particular employee is selected by the check mark, a time sheet with his name, dates and other info would be printed. One department is straightforward in that there is one sheet per employee.
The trouble is with the other department, in that for that department, each time sheet has four columns, at the top of each goes one employee's name. So the logic for this department is as follows:
1. count how many names are selected
2. if four or less are selected, enter first selected name into the first row of the first column, the second into the first rown of the second column, the third into the first row of the third colum etc.
3. if more than four are selected, enter the first four names into the first page, print the page, and enter the remaining into the second page and print, and so on until all selected names are processed.
1. works fine
2. works fine
3. works but not correctly.
So if I have say six names selected, for example, aaa, ,bbb, ccc, ddd, eee, and fff what end at the top of the columns on first page is:
eee, fff, ccc, ddd and on the second page its the same thing
The actual bit of formcalc script to do this is below, obviously it is incorrect or else missing something.
Any pointers and suggestions (in formcalc if possible) would be very welcome and appreciated.
Thanks.
// use a for loop to count number of names selected. tabel has 15 employee names
for i = 0 upto 14 do
if ((not (form1.main.front.Table2.Row[i].dbmname.isNull | form1.main.front.Table2.Row[i].dbmname == "")) and (form1.main.front.Table2.Row[i].Checkbox == 1)) then
ns = ns + 1 // ns = number of names selected
endif
endfor
for i = 0 upto 14 do //if any names are selected then process and print desk and maintenance sheet
//check to see if selected rows are not empty
if ((not (form1.main.front.Table2.Row[i].dbmname.isNull | form1.main.front.Table2.Row[i].dbmname == "")) and (form1.main.front.Table2.Row[i].Checkbox == 1)) then
//enter first selected name into column 1 and second into colum 2 etc...
form1.dbm_sheet.Table3.header2.dbm_name[np] = form1.main.front.Table2.Row[i].dbmname.rawValue
//np = name position to select next column that the next name will go into
np = np + 1
//ok - check if number of names selected was 4 or more and if first four names have been entered, lets print the first timesheet
if ((ns >= 4) and (np == 4)) then
xfa.host.print(1, "2", "2", 1, 1, 0, 0, 0) //print sheet
//first sheet with 4 names is printed, therefore reduce ns by 4
ns = ns - 4
//first sheet printed, reset np to zero
np = 0
//if less than 4 names were selected OR are left after printing first 4 then process remaining names
elseif ((ns < 4) and (np == ns)) then
xfa.host.print(1, "2", "2", 1, 1, 0, 0, 0)
// blank remaining columns that are supposed to be empty : if there are less than four names to be printed on the sheet
for i = (np) upto 3 do
form1.dbm_sheet.Table3.header2.dbm_name[np] = ""
endfor
endif
endfor
endif
endfor
helo DV,
to insert a new node element in the resulting model node following code can he used.
wdContext.node<Node name>().validate();
IPublic<controller>.I<node>Element ele = wdContext.create<node>Element(new <model structure type>());
ele.set<attribute name>("<value>");
wdContext.node<node name>().addElement(ele);
now to traverse the model node and change a column value following code can be used.
for(int i=0;i<wdContext.node<node name>().size();i++
IPublic<controller>.I<node>Element ele = wdContext.node<node name>().get<node name>ElementAt(i);
ele.set<attribute name>("");
Regards,
Piyush.
Similar Messages
-
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} -
Single row editing for multiple tables in a single page
Hi!
I have split a table with many many columns into more tables with a lower number of columns. There is an ID column (sequence generated) that is Primary Key common for all tables. Obviously, the relationship between these tables is 1 to 1, so its not about having to build master-detail pages.
What I need now is to edit all these tables in a single page: one single row from each table. The Automated Row Fetch & Automatic Row Processing (DML) processes used for the old table must be replaced by something else.
Is there a way to use in a single page more pairs of such processes for more tables?
I want to avoid manually writing processes with lot of PL/SQL code to handle row fetch & update.
Keep in mind that the page will have an ID item that can be used to identify unique rows in all my tables.
Thanks,
SorinI have split a table with many many columns into more tables with a lower number of columns
IMHO that is a very bad idea. There is nothing wrong with having many columns in a table. If you would like to split them to better "categorize" them, just create views on the table and expose different subsets of the columns.
I want to avoid manually writing processes with lot of PL/SQL code to handle row fetch & update.
That is unavoidable given how you have designed the underlying tables.
You could try creating a view that joins all the tables by the PK and creating a form based on that view. Then write a INSTEAD OF trigger on the view that "doles out" the DML on the view to each of the underlying tables. -
Internal Table data is not overflowing into Next Page - Adobeforms
Hi,
I have an issue if the internal table consits of more than 20 records that data is not overflowing into next page.
Here am using Header only on first page & Table will follows...
Regards,
PraVeen..
Edited by: praveenreddys on Feb 15, 2012 10:51 PMHi praveenreddys ,
I had the same requirement, I did as follows:
LEFT HAND SIDE SELECT "TABLE": check below right hand side properties for this object
1. table tab: select the check box allow page breaks within content.
2. pagination tab: place: Following previous
after:continue filling parent
overflow: none.
LEFT HAND SIDE SELECT "HEADER": check below right hand side properties for this object
3. row tab: select the check box allow page breaks within content.
4. pagination tab: place: Following previous
after:continue filling parent
overflow: none.
select the check boxes: Include header row in initial page
include header row in subsequent pages
Binding tab property:
5.select check box: Repeat row for each data item
LEFT HAND SIDE SELECT "ROW": check below right hand side properties for this object
6. Row tab: DON'T select the chek box allow page breaks with in content
4. pagination tab: place: Following previous
after:continue filling parent
overflow: none.
Binding tab property:
5.select check box: Repeat row for each data item
Then test..it would work for you...ALL THE BEST!!!
If this helps please reward points.
Reards,
Naresh. -
Adding Specific columns of dynamic internal table row into another column
Hi Gurus,
I need to add few columns of a dynamic internal table row into another column:
Article description hy01 hy02 total
101 panza 10 12 22
102 masht 12 12 24
dynamic internal table is created and columns hy01 hy02.... can increase
How to add the the values in hy01 hy 02... into total.
Regards,
DepHi,
If you really want to have a dynamic table, then you will have to find a way to generate a whole new table, and then copy the data from the old table to the new one. There is no way to modify a type during runtime in ABAP.
Here an example how to generate a dynamic table based on another internal table, hope this will help you.
TYPE-POOLS: slis.
PARAMETERS: p_nb_hy TYPE i DEFAULT 2. "Number of new HY columns to be added
* Type ZST_T:
* matnr TYPE matnr
* maktx TYPE maktx
* hy01 TYPE i
* total TYPE i
TYPES: ty_t TYPE STANDARD TABLE OF zst_s.
PERFORM main.
*& Form main
* text
FORM main.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_t TYPE ty_t,
lr_new_t TYPE REF TO data.
FIELD-SYMBOLS: <lt_new_t> TYPE STANDARD TABLE.
"Add some lines to LT_T just to have something to display on screen
DO 10 TIMES.
APPEND INITIAL LINE TO lt_t.
ENDDO.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZST_S'
CHANGING
ct_fieldcat = lt_fieldcat.
"Copy LT_T to LR_NEW_T
PERFORM extend_and_copy_table USING lt_t p_nb_hy CHANGING lr_new_t lt_fieldcat.
CLEAR lt_t. "Not needed anymore...
ASSIGN lr_new_t->* TO <lt_new_t>.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <lt_new_t>.
ENDFORM. "main
*& Form extend_and_copy_table
FORM extend_and_copy_table USING ut_t TYPE STANDARD TABLE
uv_nb_hy TYPE i
CHANGING cr_t TYPE REF TO data
ct_fieldcat TYPE slis_t_fieldcat_alv
RAISING cx_sy_struct_creation cx_sy_table_creation.
DATA: lo_tabledescr TYPE REF TO cl_abap_tabledescr,
lo_structdescr TYPE REF TO cl_abap_structdescr,
lo_new_structdescr TYPE REF TO cl_abap_structdescr,
lo_new_tabledescr TYPE REF TO cl_abap_tabledescr,
lt_components TYPE cl_abap_structdescr=>component_table,
ls_component TYPE cl_abap_structdescr=>component,
lv_field_cnt TYPE numc2,
ls_fieldcat TYPE slis_fieldcat_alv,
lr_fieldcat TYPE REF TO slis_fieldcat_alv.
FIELD-SYMBOLS: <ls_old_s> TYPE ANY,
<lt_new_t> TYPE STANDARD TABLE,
<ls_new_s> TYPE ANY.
"Get the list of all components from UT_T line structure
lo_tabledescr ?= cl_abap_tabledescr=>describe_by_data( ut_t ).
lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
lt_components = lo_structdescr->get_components( ).
"The new columns will be from type of column HY01
ls_component-type = lo_structdescr->get_component_type( 'HY01' ).
"The new columns will have the same fieldcat info as column HY01
READ TABLE ct_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'HY01'.
"HY<lv_field_cnt> = new field name
lv_field_cnt = uv_nb_hy + 1.
"For each new column...
DO uv_nb_hy TIMES.
"Generate the new column field name
CONCATENATE 'HY' lv_field_cnt INTO ls_component-name.
ls_fieldcat-fieldname = ls_component-name.
"Add the new field to the components of the new structure
INSERT ls_component INTO lt_components INDEX 4.
"Add the new field's fieldcat info to the fieldcat
INSERT ls_fieldcat INTO ct_fieldcat INDEX 4.
lv_field_cnt = lv_field_cnt - 1.
ENDDO.
"Adjust the COL_POS from fieldcat
LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat.
lr_fieldcat->col_pos = sy-tabix.
ENDLOOP.
"Create the new table
lo_new_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
lo_new_tabledescr = cl_abap_tabledescr=>create( p_line_type = lo_new_structdescr ).
CREATE DATA cr_t TYPE HANDLE lo_new_tabledescr.
ASSIGN cr_t->* TO <lt_new_t>.
"Copy all data from old to new table
LOOP AT ut_t ASSIGNING <ls_old_s>.
APPEND INITIAL LINE TO <lt_new_t> ASSIGNING <ls_new_s>.
MOVE-CORRESPONDING <ls_old_s> TO <ls_new_s>.
ENDLOOP.
ENDFORM. "main -
How to split a parallell-page PDF into single-page PDF
My situation: I have a few hundred pages of files I made quite a few years ago, optimized for "self-publishing" via the printer. I no longer have any source files (my own bad). These files have 2 pages next to each other in an A4 landscape PDF. I would like to change and combine these files into a US Letter portrait PDF.
I have browsed earlier, similar threads, most notably the most referred to thread:
http://forums.adobe.com/message/3331516
which recommends using Adobe PDF printer. However, as this thread points out, and as I for one have found on my own system (10.8.3), Adobe PDF printer is no longer an option on Mac OS X (version 10.6 and on):
http://forums.adobe.com/thread/556366
So the question then is: How do we now split double-page landscape PDFs into single-page portrait PDFs?Since at least OSX.5 adobe has removed PDF Printer which was begining to fail it was written in Adobe's altered version of javascript and it was a wonder it was working to begin with They replaced it with an Automator action that's called up through the print Driver.
Here are the steps for applications other than Acrobat.
create you doucument. laying it out the way you want it.
Go to Print menu.
click and hold the pdf button - a context menu pops up.
now scan the list of choices and choose Adobe PDF or Adobe Quality PDF (depends on version of OS)
wait for direction fields to come up and make the desired choices (the first screen is basically job options).
when asked ask for name either ecept name give or choose name of your choice.
Browse to desired location for file
then click save.
How the PDF is layed out in acrobat is determinedby acrobat. Adobe add an additional Layer on top of the Print Driver. You can by pass it and use the Print Driver but if there is an orientation switch in your docment the page is turned so everything comes out with same edge of Paper
Oh, look out for a Grand idea Adobe did that even Forest Gump would have left alone.
If you want to do duplex printing to a PDF with more than one page you won't be able to do so whether you have your printer setup for duplex printing. You can go back and forth from printer setting s to Printer setting toggling off and on til you turn blue in the face. You have to go into the document properties and loo for a command called SIMPLEX printing its on by default and needs to be turned off. Even my cat Boots would be smart enough not to put that in.
This settinging does not permanently turn off and you have to do with each document you create or resave. -
How to use script to get the first table row on each page?
I create a print form to display a table. I set a conditional page break on this table, so the table rows on each page could be different.
For example, there're total 50 rows in this table. On the 1st page, there're 5 rows, but on the 2nd page, there're only 2 rows, and so on...
Now I want to get some value from the 1st table row on each page. How can do that? I can refer to a table row using TableRow[n], but I don't know how to calculate 'n' in script (either FormCalc or JavaScript) for the 1st row on each page.
Any ideas?Hi Wei,
There is an option of setting the overflow header in the pallette. You may check that out. It is basically used to have the table header to be seen in all pages, if the table is overflowing to multiple pages. You may put your first row as the overflow header.
- hope this helps, Kindly update,
thanks and regards,
- anto. -
How do I output a large pdf into single pages for press?
How do I output a large pdf into single pages for press?
It is certainly a good point that, if they need the files separately, and don't even know how to use Acrobat to split it themselves, it might lead one to question their expertise in the PDF field.
-
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 -
How can i import the data from multiple sources into single rpd in obiee11g
how can i import the data from multiple sources into single rpd in obiee11g
Hi,
to import from multiple data sources, first configure ODBC connections for respective data sources. then you can import data from multiple data sources. When you import the data, a connection pool will create automatically.
tnx -
How to get the data from multiple tabes into single table
hi all,
here i am having 10 data base tables,how to get the data into a single table.
regards,
subba reddyhi,
non XI/PI related
Regards,
Michal Krawczyk -
How can I sort multiple tables on a single page as if they were one continuous table?
I have a single narrow column of numbers that cover multiple pages. I would like to do either of the following: break that long single column into multiple colums that fit on one page and are still able to be sorted in that arrangement OR sort the long column as it is (spread out over multiple pages) and then break that long sorted column down into multiple segments that can be placed onto a single page.
I have been sorting the long single column, then copy and pasting sections from the column onto a new page so that I can print them on a single page.
I am hoping there is a more elegant method to do this.Hi Walt,
Sorting is one of the things that changed between Numbers '09 and Numbers 3. If you are on Mountain Lion I want to assume you are using '09. Is that true?
This will work in '09 and 3. Table one is a single column with entries 1-89.
A2 ==INDEX(Table 1 :: $A,ROW())
B2 =INDEX(Table 1 :: $A,ROW()+35)
C2 =INDEX(Table 1 :: $A,ROW()+70)
The formulas are filled down.
You can adjust the formulas in B and C to reflect how many rows fit on your page.
quinn -
Import XML into Single Page PDF Form - Form Repeats
I have a created a PDF form in Acrobat, which is a single page that has about 16 text fields to be filled in. The data I am importing is in an XML format. I am able to import the data for a single page with no trouble. I would like to be able to import multiple pages of data and have the form repeat with the corresponding additional data.
For example,
- I have a "grid report" that is 3 rows and 16 columns. Each row of data represents a separate page. The data is converted to XML format and saved as a single file (see below sample).
- I have a single page PDF Form with text 16 fields. The text fields correspond to the column data from the "grid report"
- (Desired) After importing the XML data into the single page PDF form, I would like to have a file that has 3 pages. Each page is a replicate of the original form.
- The data contained in the 16 fields of page 1 reflect the data from Row1 of the "grid report"
- The data contained in the 16 fields of page 2 reflect the data from Row2 of the "grid report"
- The data contained in the 16 fields of page 3 reflect the data from Row3 of the "grid report"
I am not sure if I need to change the format of my XML, or if there is a way to add a tag of some kind at the end of the PDF From that indicates the (blank) form should repeat for each <Row> of data.
I am open to other reporting/form applications, but I am having a hard time finding anything online that indicates this specific functionality. I would think that this is a pretty standard process, but I am having quite the time finding a solution. Any help is GREATLY appreciated!
<?xml version="1.0" encoding="utf-16"?>
<Data>
<Row>
<BOL>82862AK</BOL>
<Movement_Date>7/10/2014</Movement_Date>
<Exporter_Addr_1>1568 Washburn Avenue</Exporter_Addr_1>
<NetWeight>191,016.4580</NetWeight>
<NetVolume>29,079.0000</NetVolume>
<SpecificGravity>0.7879</SpecificGravity>
<APIGravity>48.0913</APIGravity>
<Energy>81.5100</Energy>
<Chemical>ETHD</Chemical>
<MovementLocation>Cherokee, IA</MovementLocation>
<DestinationLocation>Toronto,ON</DestinationLocation>
<Date>7/10/2014</Date>
<City>Cherokee</City>
<State>IA</State>
<ZipCode>51012</ZipCode>
<Name>Processors</Name>
</Row>
<Row>
<BOL>82862AL</BOL>
<Movement_Date>7/10/2014</Movement_Date>
<Exporter_Addr_1>1568 Washburn Avenue</Exporter_Addr_1>
<NetWeight>190,497.5165</NetWeight>
<NetVolume>29,000.0000</NetVolume>
<SpecificGravity>0.7879</SpecificGravity>
<APIGravity>48.0913</APIGravity>
<Energy>81.5100</Energy>
<Chemical>ETHD</Chemical>
<MovementLocation>Cherokee, IA</MovementLocation>
<DestinationLocation>Toronto,ON</DestinationLocation>
<Date>7/10/2014</Date>
<City>Cherokee</City>
<State>IA</State>
<ZipCode>51012</ZipCode>
<Name>Processors</Name>
</Row>
<Row>
<BOL>82862AM</BOL>
<Movement_Date>7/10/2014</Movement_Date>
<Exporter_Addr_1>1568 Washburn Avenue</Exporter_Addr_1>
<NetWeight>190,497.5165</NetWeight>
<NetVolume>29,000.0000</NetVolume>
<SpecificGravity>0.7879</SpecificGravity>
<APIGravity>48.0913</APIGravity>
<Energy>81.5100</Energy>
<Chemical>ETHD</Chemical>
<MovementLocation>Cherokee, IA</MovementLocation>
<DestinationLocation>Toronto,ON</DestinationLocation>
<Date>7/10/2014</Date>
<City>Cherokee</City>
<State>IA</State>
<ZipCode>51012</ZipCode>
<Name>Processors</Name>
</Row>
</Data>Hi there,
Your discussion was moved to the Acrobat Forms forum: the folks here should be well suited to answer your question.
Best,
Sara -
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> -
Need to split data from one row into a new row redux
Hi folks,
I asked this question about eight months ago (see thread https://discussions.apple.com/message/23961353#23961353) and got an excellent response from forum regular Wayne Contello. However, I need to perform this operation again and when I attempted it recently, I am now greeted with a yellow warning triangle. Clicking it shows "This formula can’t reference its own cell, or depend on another formula that references this cell."
What I'm trying to do is the following:
I have an excel file that keeps track of members of a social group. The file places each member "unit" on a single row. The unit can be a single person or a couple. Columns are labeled "First1" "Last1" "Hometown1" "B-day1" while the second member of the unit is identified in columns like "First2" "Last2" etc.
What I'd like to do is duplicate those rows with two people (which I'll do by hand) but have a way of deleting the "xxxx2" data from one row and the "xxxx1" data from the duplicate row.
Wayne's illustrated solution was to create a blank sheet and enter the following formula in cell A2:
=OFFSET(Input Data::$A$2, INT((ROW()−2)÷2), COLUMN()−1+IF(MOD(ROW()−2, 2)=0, 0, 4)), which apparently worked fine for me last year but now is sending up an error flag. When I look at the formula, there is no clue except that which I quoted above.
Can anyone (or hopefully Wayne) take a second look at this and help me out? I can't imagine that it's a problem with using the newer version of Numbers, but who knows? I'm using version 3.2 (1861), which is the "new" Numbers.
Any help would really be appreciated.
Thanks!
-TodHi Tod,
The error message "This formula can’t reference its own cell, or depend on another formula that references this cell." may be because your table may be different from the one you were using for Wayne's solution. Numbers has Header Rows, Footer Rows and Header Columns. Such Headers in tables exclude themselves from formulas. Excel does not recognise them as headers. What table are you using now?
A screen shot of (the top left portion of) your table or a description of what you see under Menu > Table will help.
Regards,
Ian.
Maybe you are looking for
-
Enable Recycle Bin on mapped network drives
A few years ago I discovered how redirected user profile folders in Windows get Recycle Bin protection, even when the folders are redirected to a network location. This was a huge find for me, and I used this feature to add Recycle Bin coverage to so
-
GR / IR Clearing A/c not clearing open items
Dear SAP Gurus, I am working for GR/IR clearing account. Following is the case. 1) I have made the PO for quantity 10 @ rate of 100/- per qty. 2) With reference to PO I have made the Migo for that a/c entry is. Inventory A/c - 1000 --- To
-
NTSC to PAL as .MPEG in Compressor 3.0.5
We're using FCP 6.0.6 with Compressor 3.0.5. We are to begin making PAL versions of our show with the following specifications: Format: Mpeg-2 Stream Type: Program Stream Main Profile @ Main Level Video Bit Rate: CBR 8 Mbps Image Size: 720 x 576
-
Hi Guys... I am using Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production on Solaris. I am trying to clone one of the production database using backups on tape. I am using Veritas Netbackup for backups. When I include the following: allo
-
We're just getting started in InDesign CS4. We've been editing a file for a few days. It has over 300 pages in it, all the text in a single story. We reached a point where making the next correction caused the file to hang up for a very long time (mo