Row to Column mapping
Hi Team,
I have data like below
Table Name Line_Item
Column are
Product_name--------Mapping ID--------Values
ABC-----------------------344-----------------------3
ABC-----------------------345-----------------------Months
BCD-----------------------346-----------------------1
BCD-----------------------347-----------------------Year
Mapping ID is constant value not change in this but values will change ..
my output should be like below format
Product_name--------Period-----------Values
ABC--------------------3--------------------Months
BCD--------------------1--------------------Year
Thanks for you advance ....
Thanks for you response.
Grey, for a product we have only 2 value i.e(ABC product we have 3,Months mapping)
we don't get the below format of data.
ABC-----------------------344-----------------------3
ABC-----------------------345-----------------------Months
ABC-----------------------346-----------------------4
ABC-----------------------347-----------------------Weeks
we get the data like
ABC-----------------------344-----------------------3
ABC-----------------------345-----------------------Months
ZYX-----------------------346-----------------------4
ZYX-----------------------347-----------------------Weeks
OUTPUT should be below
ABC-----------------------3-----------------------Months
ZYX-----------------------4-----------------------Weeks
Please let me know if you have any concerns
Edited by: 870003 on Feb 13, 2012 5:34 AM
Similar Messages
-
Row to column mapping and combining columns
Hi
I have one issue i want to concatenating some columns and map row as columns like below.I am giving one ex and have more than 1000 employees like this
Example
{Srno Eno Ename job datestart}
{1 01 jack------clerk------01-Jan-2008}
{ 2 01 jack-----snrclerk----01-Jun-2009}
{ 3 01 jack ---- officer------- 01-Jan-2010}
I want to display the row to columan mapping like first row concatenated as col2 and second row for col2 column etc
{eMpno------- col1 ------------------co12----------------------------------col3}
{0101 jackclerk 01-Jan-2008---jacksnrclerk01-Jun-2009------01jackofficer01-Jan-2010}
rgds
ramya
Edited by: user11243021 on Sep 7, 2010 5:21 AMwith t as (
select 1 srno,'01' eno,'jack' ename,'clerk' job,to_date('01-Jan-2008','dd-mon-yyyy') datestart from dual union all
select 2 srno,'01' eno,'jack' ename,'snrclerk' job,to_date('01-Jun-2009','dd-mon-yyyy') datestart from dual union all
select 3 srno,'01' eno,'jack' ename,'officer' job,to_date('01-Jan-2010','dd-mon-yyyy') datestart from dual
) -- end of data sample
select eno,
max(
case srno
when 1 then ename || ' ' || job || to_char(datestart,' dd-Mon-yyyy')
end
) col1,
max(
case srno
when 2 then ename || ' ' || job || to_char(datestart,' dd-Mon-yyyy')
end
) col2,
max(
case srno
when 3 then ename || ' ' || job || to_char(datestart,' dd-Mon-yyyy')
end
) col3
from t
group by eno
EN COL1 COL2 COL3
01 jack clerk 01-Jan-2008 jack snrclerk 01-Jun-2009 jack officer 01-Jan-2010
SQL> SY. -
Mapping of JTable Rows and columns and paint it to the JPanel
Hi,
I am using JTable and graphics object to draw the JTable on JPanel. But due to some lack of measurement I am not able to draw table cells correctly.
Apart from this on changing the fontSize I have to redraw it according to the requirement. But when the data size increases it draws absurdly.
I am using jTable.getCellRect() api to get the row width and height. Please help to redraw a JTable cell row and height on JPanel.
I am also attaching a sample code with this mail.
Thanks,
Ajay
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.*;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.table.*;
import java.util.*;
import java.awt.*;
public class SimpleTableDemo extends JPanel {
private boolean DEBUG = false;
private int spacing = 6;
private Map columnSizes = new HashMap();
String[] columnNames = {"First Name",
"Last Name",
"Sport",
"# of Years",
"Vegetarian"};
Object[][] data = {
{"Kathy", "Smith",
"SnowboardingXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new Integer(5), new Boolean(false)},
{"John", "Doe",
"Rowing", new Integer(3), new Boolean(true)},
{"Sue", "Black",
"Knitting", new Integer(2), new Boolean(false)},
{"Jane", "White",
"Speed reading", new Integer(20), new Boolean(true)},
{"Joe", "Brown",
"Pool", new Integer(10), new Boolean(false)}
final JTable table = new JTable(data, columnNames);
Panel1 panel;
public SimpleTableDemo() {
super(new GridLayout(3,0));
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
//table.setFillsViewportHeight(true);
if (DEBUG) {
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
printDebugData(table);
//Create the scroll pane and add the table to it.
JScrollPane scrollPane = new JScrollPane(table);
//Add the scroll pane to this panel.
add(scrollPane);
panel = new Panel1();
Rectangle rect = table.getCellRect(0,0,true);
panel.setX(table.getWidth());
panel.setY(0);
panel.setWidth(rect.width);
panel.setHeight(rect.height);
panel.setStr(table.getModel().getValueAt(0,0).toString());
panel.setModel(table);
add(panel);
final JComboBox jNumberComboBoxSize = new JComboBox();
jNumberComboBoxSize.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "11", "12", "14", "16", "18", "20", "24", "30", "36", "48", "72" }));
jNumberComboBoxSize.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jNumberComboBoxSizeActionPerformed(jNumberComboBoxSize);
JPanel panel2 = new JPanel();
panel2.add(jNumberComboBoxSize);
add(panel2);
adjustColumns();
private void jNumberComboBoxSizeActionPerformed(JComboBox jNumberComboBoxSize)
int fontSize = Integer.parseInt(jNumberComboBoxSize.getSelectedItem().toString());
table.setRowHeight(fontSize);
table.setFont(new Font("Serif", Font.BOLD, fontSize));
Rectangle rect = table.getCellRect(0,0,true);
panel.setX(0);
panel.setY(0);
// panel.setWidth(rect.width);
panel.setHeight(rect.height);
panel.setStr(table.getModel().getValueAt(0,0).toString());
panel.setModel(table);
panel.repaint();
table.revalidate();
private void printDebugData(JTable table) {
int numRows = table.getRowCount();
int numCols = table.getColumnCount();
javax.swing.table.TableModel model = table.getModel();
System.out.println("Value of data: ");
for (int i=0; i < numRows; i++) {
System.out.print(" row " + i + ":");
for (int j=0; j < numCols; j++) {
System.out.print(" " + model.getValueAt(i, j));
System.out.println();
System.out.println("--------------------------");
* Adjust the widths of all the columns in the table
public void adjustColumns()
TableColumnModel tcm = table.getColumnModel();
for (int i = 0; i < tcm.getColumnCount(); i++)
adjustColumn(i);
* Adjust the width of the specified column in the table
public void adjustColumn(final int column)
TableColumn tableColumn = table.getColumnModel().getColumn(column);
if (! tableColumn.getResizable()) return;
int columnHeaderWidth = getColumnHeaderWidth( column );
int columnDataWidth = getColumnDataWidth( column );
int preferredWidth = Math.max(columnHeaderWidth, columnDataWidth);
panel.setWidth(preferredWidth);
updateTableColumn(column, preferredWidth);
* Calculated the width based on the column name
private int getColumnHeaderWidth(int column)
TableColumn tableColumn = table.getColumnModel().getColumn(column);
Object value = tableColumn.getHeaderValue();
TableCellRenderer renderer = tableColumn.getHeaderRenderer();
if (renderer == null)
renderer = table.getTableHeader().getDefaultRenderer();
Component c = renderer.getTableCellRendererComponent(table, value, false, false, -1, column);
return c.getPreferredSize().width;
* Calculate the width based on the widest cell renderer for the
* given column.
private int getColumnDataWidth(int column)
int preferredWidth = 0;
int maxWidth = table.getColumnModel().getColumn(column).getMaxWidth();
for (int row = 0; row < table.getRowCount(); row++)
preferredWidth = Math.max(preferredWidth, getCellDataWidth(row, column));
// We've exceeded the maximum width, no need to check other rows
if (preferredWidth >= maxWidth)
break;
return preferredWidth;
* Get the preferred width for the specified cell
private int getCellDataWidth(int row, int column)
// Inovke the renderer for the cell to calculate the preferred width
TableCellRenderer cellRenderer = table.getCellRenderer(row, column);
Component c = table.prepareRenderer(cellRenderer, row, column);
int width = c.getPreferredSize().width + table.getIntercellSpacing().width;
return width;
* Update the TableColumn with the newly calculated width
private void updateTableColumn(int column, int width)
final TableColumn tableColumn = table.getColumnModel().getColumn(column);
if (! tableColumn.getResizable()) return;
width += spacing;
// Don't shrink the column width
width = Math.max(width, tableColumn.getPreferredWidth());
columnSizes.put(tableColumn, new Integer(tableColumn.getWidth()));
table.getTableHeader().setResizingColumn(tableColumn);
tableColumn.setWidth(width);
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("SimpleTableDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
SimpleTableDemo newContentPane = new SimpleTableDemo();
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
class Panel1 extends JPanel
int x;
int y;
int width;
int height;
String str;
JTable model;
public void setModel(JTable model)
this.model = model;
public void setX(int x)
this.x = x;
public void setY(int y)
this.y = y;
public void setWidth(int w)
this.width = w;
public void setHeight(int h)
this.height = h;
public void setStr(String s)
this.str = s;
public void paint(Graphics g)
super.paint(g);
int initX= 0;
for(int row=0;row < 5; ++row)
initX = x;
for (int col=0;col < 5;++col)
g.drawRect(x,y,width,height);
g.drawString(model.getModel().getValueAt(row,col).toString(),x + 10,y + 10);
x = x + width;
x = initX;
y = y + height;
};an easy way would be to use setSize()
-
Map CdC op transform SEQUENCE and ROW oper column properties
I am using Map_cdc_op transform, for sequence column and row operation column properties, what fields should i choose?
My source table has the following columns:
RMID - primary key int
RMName - varchar
created_date datetime
Last_updated datetime
target table also has above 4 columns plus one rmLogID column with int data type. which is key column in target.
does map_cdc_op transform also take care of the surrogate key column id in target? which is "rmlogid".
thank you very much for the helpful info.Suneer I am using SQL serverdatabase, this table is dragged to workspace as source:
RMID - primary key int
RMName - varchar
created_date datetime
Last_updated datetime
My task is to capture data changes from this table to target table, for that i a using Map_op_CDC transform, now under the properties SEQUENCE and ROW oper column what fields should i pic.I never used this transform before.
RMid is the primary key in source, rest teh of teh fields are changeable. i track created_dt and last_updated dates for that row.
Thanks a lot for the helpful info. -
Warning in WD ABAP Table - Master Column Mapping deprecated
Hi ,
I am getting a warning 'Master Column Mapping deprecated' in a WD ABAP component while activating it .
Can anybody suggest what I have to do to solve this issue .
Best Regards
SidHi,
Could you please tell me how to take Row Arrangement in Master Column?
Cheers
Harkesh Dang -
Need help with Pivoting rows to columns
Hi,
I need help with pivoting rows to columns. I know there are other posts regarding this, but my requirement is more complex and harder. So, please give me a solution for this.
There are two tables say Table 1 and Table 2.
Table1
name address email identifier
x e g 1
f s d 2
h e n 3
k l b 4
Table2
identifier TRno zno bzid
1 T11 z11 b11
1 T12 z12 b12
1 T13 z13 b13
2 T21 z21 b21
2 T22 z22 b22
As you can see the identifier is the column that we use to map the two tables. The output should be like below
output
name address email identifier TRno1 zno1 bzid1 TRno2 zno2 bzid2 TRno3 zno3 bzid3
x e g 1 T11 z11 b11 T12 z12 b12 T13 z13 b13
f s d 2 T21 z21 b21 t22 z22 b22
Also we do not know exactly how many TRno's, zno's, etc each value in the identifier will have. There may be only 1 TRNO, zno and bzid, or there may be four.
All the values must be in separate columns, and not be just comma delimitted. There are also other conditions that i have to add to restrict the data.
So, can you please tell me what is should use to get the data in the required format? We are using Oracle 10g. Please let me know if u need any more informationSomething like this ?
SCOTT@orcl> ed
Wrote file afiedt.buf
1 select a.name,
2 a.address,
3 a.email,
4 b.* from (
5 select distinct identifier
6 ,max(trno1) trno1
7 ,max(zno1) zno1
8 ,max(bzid1) bzid1
9 ,max(trno2) trno2
10 ,max(zno2) zno2
11 ,max(bzid2) bzid2
12 ,max(trno3) trno3
13 ,max(zno3) zno3
14 ,max(bzid3) bzid3
15 ,max(trno4) trno4
16 ,max(zno4) zno4
17 ,max(bzid4) bzid4
18 from (select identifier
19 ,decode(rn,1,trno,null) trno1
20 ,decode(rn,1,zno,null) zno1
21 ,decode(rn,1,bzid,null) bzid1
22 ,decode(rn,2,trno,null) trno2
23 ,decode(rn,2,zno,null) zno2
24 ,decode(rn,2,bzid,null) bzid2
25 ,decode(rn,3,trno,null) trno3
26 ,decode(rn,3,zno,null) zno3
27 ,decode(rn,3,bzid,null) bzid3
28 ,decode(rn,4,trno,null) trno4
29 ,decode(rn,4,zno,null) zno4
30 ,decode(rn,4,bzid,null) bzid4
31 from (select identifier,
32 trno,bzid,zno,
33 dense_rank() over(partition by identifier order by trno,rownum) rn
34 from table2)
35 order by identifier)
36 group by identifier) b,table1 a
37* where a.identifier=b.identifier
SCOTT@orcl> /
NAME ADDRESS EMAIL IDENTIFIER TRNO1 ZNO1 BZID1 TRNO2 ZNO2 BZID2 TRNO3 ZNO3 BZID3 TRNO4 ZNO4 BZID4
x e g 1 T11 z11 b11 T12 z12 b12 T13 z13 b13
f s d 2 T21 z21 b21 T22 z22 b22
SCOTT@orcl> select * from table1;
NAME ADDRESS EMAIL IDENTIFIER
x e g 1
f s d 2
h e n 3
k l b 4
SCOTT@orcl> select * from table2;
IDENTIFIER TRNO ZNO BZID
1 T11 z11 b11
1 T12 z12 b12
1 T13 z13 b13
2 T21 z21 b21
2 T22 z22 b22
SCOTT@orcl>Regards
Girish Sharma -
How to transpose the data records (rows) to column(lists) using apd
Hi,
how to transpose the data records (rows) to column (lists) using apd in sap bw.
I do not want to use abap routine.only use the transpose rows to list transformation .
Pls provide the step by step procedure .
thanks,
NimaiSave youe file to transpose as a csv and in the header row of your file for the columns you want to transpose you need to put some soer of a tag before the column name (ie your colum header was for a period budget will be something lie 2011001:ZFIBDD)
1. You will need to create a new apd process (rsanwb)
2. Insert a "Read from Data File" data source object and map it file (,csv)
3. insert a transpose object into your apd process (middle row 4th one over in the transformations section)
4. under the definition tab in the transformation object select all the columns that are to be transposed into rows and move them to the transformed area, the grouping fields section should contain the rows that you want to now be columns
5.under the transformation tab enter in the seperator you selected under the Field Name/Infoobject area (ie. ZFIBDD)
6. under the details tab you need to enter in all the fields to be transformed and tner the transposition field (ie ZFIBDD)
7. Then you can insert a set of transformations and a DSO and link the newly transposed fields into that.
hope that helps -
Column Mapping while loading data via tab delimited text file
While attempting to load data I get an error message at the "Define Column Mapping" step. It reads as follows:
1 error has occurred
There are NOT NULL columns in SYSTEM.BASICINFO. Select to upload the data without an error
The drop down box has the names of the columns, but I don't know how to map them to the existing field names, I guess.
By the way, where can I learn what goes in "format" at this same juncture.
Thanks!You can use Insert Into Array and wire the column index input instead of the row index as shown in the following pic:
Just be sure that the number of elements in Array2 is the same as the number of rows in Array1.
Message Edited by tbob on 03-07-2006 11:32 AM
- tbob
Inventor of the WORM Global
Attachments:
Add Column.png 2 KB -
About the number of rows used to map data in Xcelsius
Hi Everyone:
I am using web services to fetch data into Xcelsius. The information I got from web service will increase in time and what I suppose is when I run out of rows to get all data I must open my Xcelsius model and select a greater range of rows on each component to get all the data that the web service is bringing.
Is there an alternative to avoid modifying ranges of data in crontrollers when rows mapped are not enough for the data you are fetching from a web service?
It is a bit confusing, I hope I've been clear enough. I really really will appreciate your opinions. If possible give me technical explanations.
Thank you,
Skull
Edited by: skull_buck on Aug 6, 2009 7:40 PMHi Greg
Thanks for your fast reply.
What you suggested is exactly what I am doing now, and also I increased the number of rows allowed to map en Xcelsius which are 512 by default.
I would like to know now, how many rows are advisable to increase? Because I am using some components and you must specify for each one a certain number of rows.
I test mapping 3000 and even 6000 rows but the model is too slow and I was not able to export the swf file in any format.
Thank you again,
Skull -
Some '???' appeared in the LOV Column Mapping window ...only
Hi,
I installed the Forms6i with the patch 12 on Windows XP platform. The installation language is Greek. The only problem i have faced up with the installation is the appearance of some question marks in LOV Column Mapping window ... instead of the Greek translation of the phrases:
Column Names ,
Return Item ,
Display Width ,
Column Title
Is there a specific Windows font that should be installed ....or something else...????
Thanks,,,,
SimYou have to do it from the source code. Click on source, you will find "<xsl:if test="">".
Define your condition in test="/tns:input1=/tns:input2" or check if you source string contains "abcd", i.e. xsl:if test="contain(/tns:source_column1,'abcd')"
hope this will help -
how can i open a PDF bank statement in "numbers" so that the rows and columns contain properly aligned data from statement?
Numbers can store pdfs pages or clippings but does not directly open pdf files. To get the bank statement into Numbers as a table I would open the bank statment in Preview (or Skim) or some pdf viewer.
Then hold the option key while selecting a column of data.
Then copy
Then switch to numbers and paste the column into a table
Then repeat for the other columns in the pdf document
It would be easier (in my opinion) to download the QFX or CSV version from your bank -
How to accessing current row report column value in Lov Query?
Hi,
which access methods (eg. bind variables, substitutions, ...) for getting the current row report column value can be used in the "Lov Query" property of a report column?
As what I know of and what I have read on the forum there are no bind variables for the report columns. For the "Link Text" property it seems that the column values exist as substitution strings (#COLUMN_NAME#). But they don't work in the Lov Query. => And would be good because of a hard parse each time the Lov query is executed.
The following post (Re: Simulating a correlated sub query in lov
is showing a solution to use package variables for temporary storage of the referenced value, but the only problem with that solution is that if a new record is added with the "Add rows to tabular form" process the package variable still contains the value from the last queried row! Is there a way (variable, APEX package, ...) to determine if the lov query is executed for a new record so that the package can return null?
I know that I could write the package in a way that the value is immediately cleared when lov_pkg.keyval is called (one time read), but then I would have to create several variables if I'm accessing the value multiple times in the query or in another query => I think an one time read solution would be very obscurely.
Thanks for your help
Patrick
http://inside-apex.blogspot.comHi Patrick,
I agree that it's a waste to continually use Ajax to go back to the server to get the contents of a dynamic select list.
There are no bind variables for any row item - but what you do have, as per my previous post, is the value of the data entered by the user in the first row. You can pass this into your application process (using get.add("VARIABLENAME", value)), which can use it to retrieve the correct LOV in your Ajax code - this will give you a "bind variable" that your process can use.
What you could do, however, is generate hidden select lists on your page - one for each possible LOV list and replace the contents of the new row's select list with the contents of the appropriate hidden select list. This is easy to do with javascript (using innerHTML functions). Obviously, though, the usefulness of this depends on the number and size of the select lists.
Even if you don't generate them to start with, you can keep a copy of any select lists returned by Ajax in the DOM for use on new rows. So, if you have retrieved a select list, you will have a copy of it in DOM which you can then copy into the new row. If you don't have the list in DOM, use Ajax to get it, store a copy of it and copy it into the new row.
Which method you use will depend on the number/size of select lists needed. If they are few in number and/or size, I would suggest generating hidden lists. If they are large, use Ajax to get them once, store them and then retrieve them from the DOM when needed.
There is another thread here where Arie recommends going to the server every time to make sure you get the most up-to-date data for the lists. If you want to follow this advice, for this reason, use get.add("VARIABLENAME", value) to pass the value to your process. If this is not an issue, you can use one of the other methods I outlined above.
Regards
Andy -
Row Selector column on Interactive Report
Hi all,
I have an interactive report based on a custom SQL query. How do I add a row selctor column so I cans select individual rows? I have also tried using a tabular form which also does not display a row selctor column. This is odd as my other tabular forms display a row selctor column.
Many thanks for you help,
ChrisChris,
Usually when someone wants a row selector, it's to choose a few rows by clicking a checkbox, then doing something with them. I'm guessing that's what you're looking for?
Martin Giffy D'Souza's [blog post|http://apex-smb.blogspot.com/2009/01/apex-report-with-checkboxes-advanced.html] explains one way to do that which should work for you. I haven't tried, it, but it looks pretty comprehensive.
Good luck,
Stew -
How to create a report region which the first colomn is row selector column
I want to create a report region and its first column is a row selector column. I have used select sentence to select some columns. But I do not know how set the first column to row selector column. I mean I want to do as follow. When a radio which is first column is chosen, it will return it's value of the column in the chosen row. Please help me! Thanks
Hi unnamed,
Suppose you have an id that identifies your record.
Go to Report definiton, tab report attirbutes.
Select the id of your record.
Create a link to the page you want to go to.
Hope this helps.
If not, I suggest you to create a from with report, and analyze the way the wizard has generated it.
Leo -
How to get number of rows and columns in a two dimensional array ?
Hello,
What would be the simplest way to get number of rows and columns in a two dimensional array represented as integers ?
I'm looking for another solution as For...Each loop in case of large arrays.
Regards,
PetriHi Petri,
See a attached txt file for obtaining two arrays with upper and lower index values
Regards
Ray
Regards
Ray Farmer
Attachments:
Get2DArrayIndex.txt 2 KB
Maybe you are looking for
-
hi, I am reading chapter 10 of expert oracle database architecture by tom kyte, and I am getting a little confused. It seems to me as if he is saying that an IOT should be built using the PK of that table. What if our table does not have a PK? thanks
-
Creating Spot color in InDesign CS4, js
Hi, I have this code: try{ myColor = myDoc.colors.item("EMBOSS"); myName = myColor.name; catch (e){ myColor = myDoc.colors.add({name:"EMBOSS", model:ColorModel.SPOT, colorValue:[100, 0, 0, 0]}); But the color created still process. How do I change it
-
I am using a current date script on my website which works fine, but I would like to modify it slightly and am unsure how to do it. I have tried different scripts but was unsuccessful. Here is what I am currently using: <script type="text/javascript"
-
Use of construction type field in Equipment master
Dear All, What is the use of construction type field in equipment master and how can i use in plant maintenance processes or transactions If possible give some examples.Also any one have some document or link related to construction type, kindly pro
-
Error using DOS Command from Java
Hi, I am using the following code to execute the DOS command to delete a file from Java. cmd = "del " + fileName; Runtime run = Runtime.getRuntime(); Process proc = run.exec(cmd); Getting the following exception during runt time. Exception = java.io.