Display Query Output - Rows as Columns
Hi ,
I am fetching data as follows.
ITEM CODE, DESCRIPTION, UOM, PRICELISTNAME, PRICELISTVALUE
Item can exists in more than one price list.
I want get the output as follows
ITEM CODE, DESCRIPTION, UOM, PLIST1 PLIST2
X X X PLIST VAL1 PLISTVAL2
Y Y Y PLISTVAL2
Item X exists in PLIST1 and PLIST2, but, item Y exists in only Plist2.
Can this be possible. Please let me know, if some one as solution for this requirement.
Regards/Prasanth
ITEM CODE...DESCRIPTION....UOM.......PLIST1.......PLIST2
X..................X.........................X.............PLVAL1.....PLVAL2
Y.................Y.........................Y..............................PLVAL2
Similar Messages
-
How to display number of rows as columns in a select statement? This is on
How to display number of rows as columns in a select statement? This is on 10g R2.
Thanks,
RFor the current (ie. row 1 of 100)
row_number over (order by -pick_a_column_set) as rnfor the total number of columns returned in your query
count(*) over() as total_count -
Trying to display query results in 2 columns
I am trying modify someone elses existing code to display the
results of a query in 2 columns on a web page.
The result of the existing code can be seen
here
Below is the code that I am trying to modify
<table width="95%" border="0" align="center"
cellpadding="4" cellspacing="2">
<cfoutput query="News" startrow="#StartRow_News#"
maxrows="#MaxRows_News#">
<tr align="center" class="TEXTnormal">
<td nowrap class="TEXTnormal
style1">................................................................................. ...................................</td>
</tr>
<tr class="TEXTnormal">
<td><table width="100%" border="0" cellpadding="0"
cellspacing="0" class="TEXTnormal">
<tr>
<td><cfif News.ImageNameThumb gt 0>
<a href="news_view.cfm?recordID=#News.ID#"><img
src="uploadedimages/#News.ImageNameThumb#"
alt="#News.ImageCaption#" hspace="8" vspace="0" border="0"
align="left"></a>
<cfelse>
</cfif></td>
<td><a href="news_view.cfm?recordID=#News.ID#"
class="TEXThighlight">#News.Title#</a> -
#News.Day#.#News.Month#.#News.Year# <br>
#News.Summary#</td>
</tr>
</table></td>
</tr>
</cfoutput>
</table>
I have changed the above code to
<table width="95%" border="0" align="center"
cellpadding="4" cellspacing="2">
<cfset LoopEndRow = CEILING(#EndRow_News#/2)>
<cfloop
index = "row"
from = "#StartRow_News#"
to = "#LoopEndRow#"
step = "1">
<tr class="TEXTnormal">
<cfset breaker = 0>
<cfloop
index = "column"
from = "0"
to = "2"
step = "1">
<cfoutput query="News1" startrow="#StartRow_News#"
maxrows="#MaxRows_News#">
<td width="50%">
<table width="100%" border="0" cellpadding="0"
cellspacing="0" class="TEXTnormal">
<tr>
<td><cfif News1.ImageNameThumb gt 0>
<a href="news_view.cfm?recordID=#News1.ID#"><img
src="uploadedimages/#News1.ImageNameThumb#"
alt="#News1.ImageCaption#" hspace="8" vspace="0" border="0"
align="left"></a>
<cfelse>
</cfif></td>
<td><a href="news_view.cfm?recordID=#News1.ID#"
class="TEXThighlight">#News1.Title#</a> -
#News1.Day#.#News1.Month#.#News1.Year# <br>
#News1.Summary#</td>
</tr>
</table></td>
<cfset breaker = breaker+1>
<cfif breaker EQUAL 2>
<cfbreak>
</cfif>
</cfoutput>
</cfloop>
</tr>
</cfloop>
</table>
The results of this modified code can be see
Here
as you can see what I have done gives the correct number of
columns (2)
and the correct number of rows for the quantity of data (3)
however each row shows only the first 2 pieces of data
returned by the query
Can I modify the query output so that it returns pieces of
data off set by the amount of data already output?
if so how?Right off the bat, you have 2 loops and I cant see why...
So what is happening, is the outer loop is going 3 times...
for 3 rows, then your inside loop is showing the first record, the
Breaker var is breakign out of this loop after one row is shown.
Then the main loop says do it again...
You don't need nested loops to accomplish this, I dont
understand why you would think of needing that...
Looking at your code, just get rid of the outer loop... there
is no need for it. You are already looping around the query object
in the inner loop, thats all you need...
Heres some psudeo code to help you out...
loop around query maximum of 6 rows
-- display data
-- if recordcount EQ 2 or recordcount EQ 4 then
----- </tr><tr> <!--- this will make the new
row --->
end loop -
Funcion to display query output
Hi,
I want to create a funcion like below.
I will pass select query to function from my java application and function should return query output. Then I will use output into my application display part, results may be thousands of rows. Will it work ? If works which is the faster between calling a funcion and using "open resultset" method.
Please tell me how to create funcion like above and how to use funcion returned values in java program.
Could some one guide me.
Thanks.ITEM CODE...DESCRIPTION....UOM.......PLIST1.......PLIST2
X..................X.........................X.............PLVAL1.....PLVAL2
Y.................Y.........................Y..............................PLVAL2 -
Cursor in select query in row to column format
Hi
I have the query like below
SELECT d.department_id,
CURSOR(SELECT e.first_name,
e.last_name
FROM employees e
WHERE e.department_id = d.department_id
) emps
FROM depatments dI want the result set in a format of Row To columns like
10 20
<cursor result> <cursor result>pls give ur suggestions how to achieve this in a efficient way?I tried the method of "max(decode(.." but dont think so its possible with thisvishnu prakash wrote:
Hi
I have the query like below
SELECT d.department_id,
CURSOR(SELECT e.first_name,
e.last_name
FROM employees e
WHERE e.department_id = d.department_id
) emps
FROM depatments dI want the result set in a format of Row To columns like
10 20
<cursor result> <cursor result>pls give ur suggestions how to achieve this in a efficient way?I tried the method of "max(decode(.." but dont think so its possible with thisNumber of column of a select query is static. Must be known at the parsing time itself. But in your case i dont think the number of columns will be limited to 2 (10 and 20) there could be many more.
You can search this forum to see how to PIVOT your data. There are lot of example. You can also try dynamic pivot. Its all in here, just search. -
Post Author: blofrese
CA Forum: Exporting
I am using Crystal XI and need to output several columns worth of data. Do to so I attempted to have the data presented in 2 rows within the same section.
Example:Page Header b contains: 7 columns 5 columns
Details a contains: 7 columns 5 columns
When exporting to excel data only I only see the bottom 5 column header info and all the detail data in the correct order. How do I get all the Headers to display on the export file?
Thank you for your time.Post Author: jw1234
CA Forum: Exporting
I have the same problem. Have you find the solution yet??
I'm trying to export as Excel data only and have 2 page header band. It only display the 2nd band with the bottom label. None of the 1st band shows up.
Page Header a contains:Report TitleDate Range
Page Header b contains:Dept Name4 columns
Please help. Thanks! -
Query Designer - Rows between Columns
Dear all,
I've got the following requirement and I really cannot figure out if it is doable.
I would appreciate your help.
I shall create a query using Sap Query Designer regarding the actual and budet data of the assets (it's a financial report).
I'll have 2 columns for the actual data and 2 columns for the budget data.
Is there any way:
a) to have the assets (the rows) in the middle of the report layout, and
b) the actual data on the left side of the assets, and
c) the budget data on the right side of the assets
The goal is when drilling down the assets, both pairs of columns to be expanded as well.
Is it doable? Is there any trick?
Thanks in advance.Dear Riyez
I do thank you for your response.
I am wondering if there is something someone could possibly do on the Query Designer side in order to fool the system.
For instance, to design a virtual structure (I do not know how - I am thinking loudly) which would be identical to the structure that holds the assets?
In other words, is it designeable to have a row structure, then the column key figures and, finally, another row structure identical to the first one? And when the user expands the first structure, the second structure will follow accordingly?
Or such a solution is out of question? -
Hi,
i have one table temp1:
select * from temp, it's display:
id name add
1 xx xx1
2 yy yy1
3 zz zz1
But i want display like this:
1 2 3
xx yy zz
xx1 yy1 zz1
Help me on this.....still problem not solveing.
help me on this.
normal output:
1 xx xx1
2 yy yy1
3 zz zz1
Actual output:
1 2 3..............................
x yy zz..............................
xx1 yy1 zz1................................. -
Display of table rows and columns in OAF
Hi All,
I am developing a custom page which has one table.
This page table should display the fields and it's corresponding values side by side.
for eg:
Header1 Header2
Lable1(field prompt) value1
Lable2(field prompt) value2
Lable3(field prompt) value3
Lable4(field prompt) value4
Lable5(field prompt) value5
Here:
Header1 is the prompt name of the header for Lables
Header2 is the prompt name of Values
Lables are the field names and values are its corresponding values.
Is there any special region/options to achieve this on OAF page.
Please help me
Thanks,
SrinivasHi Srinivas,
A table or advanced table can accomplish your requirements. Advanced tables have added features that can be included declaratively vs programatically. The dev guide has detailed examples on the various options.
Regards,
LC -
Need to display my table rows as columns (have tried lots, still no luck)
My data is as follows:
attribute_name attribute_value
VisitType Housing
Priority 1
I need it to come out in this format:
VisitType Priority
Housing 1
It's set up this way to make some of the fields user definable. Therefore, VisitType is defined by the user and isn't set in stone.
I don't like this model but I'm stuck with it. Have tried a few things but nothing works!!
please help.may be this could help.
Create table Att_tab (
Attribute_name varchar2(30),
Attribute_type varchar2(30))
Insert into Att_tab
Select 'VisitType', 'Housing' from dual
union all
Select 'Priority', '1' from dual;
Select * from Att_tab;
SELECT srno,
LTRIM(MAX(SYS_CONNECT_BY_PATH(Attribute_name,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS Attribute_name,
LTRIM(MAX(SYS_CONNECT_BY_PATH(Attribute_type,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS Attribute_type
FROM (SELECT 1 srno,
Attribute_type,
ATTRIBUTE_NAME,
ROW_NUMBER() OVER (PARTITION BY 1 ORDER BY Attribute_type) AS curr,
ROW_NUMBER() OVER (PARTITION BY 1 ORDER BY Attribute_type) -1 AS prev
FROM Att_tab)
GROUP BY srno
CONNECT BY prev = PRIOR curr AND srno = PRIOR srno
START WITH curr = 1; -
How to display 2 dimensional data. i.e with rows and columns?
Hi,
I want to know how to display multiple, variable
rows and columns that are got from the database through
queries in forms.
(i,e. a Matrix of Values,something similar to an Excel Spreadsheet).
Is there a component in forms similar to JTABLE that is
available in Java through which MULTIPLE, VARIABLE
rows and columns can be displayed ?.
I am not using a base table since this data is got thru
a number of packages and procedures that are used in
Loops.
NOTE : I am using forms 6i.
Thanks
Sharath.I've heard Grant mention adding a Grid component to the Forms toolbox. From the context I would guess this is not yet even under development, so it's not going to be available anytime soon. And not for 6i.
Sorry, APC -
Formulas results outside of row and column axis
The report has an area of row axis and column axis. This area is where the results from BW are displayed.
We have a requirement where we would have to create formulas using the BW Analyzer results of the row axis and column axis and display the results after the last row of this area.
For example, after the BW Analyzer displays the result area to the Excel, we are required to take Excel Cell D10 * C7 and put the results to B33.
<b>B33 = D10*C11</b>
Excel row 30 is the last row from the row axis result area.
I have searched through the forum for Cell Editor, but it seems that the requirement is to use 2 structures and use Cell Editor only when there is a formula collision. Our requirement has 1 structure, but I guess we can create the other structure for the column axis results. But still I think Cell Editor is a computation of formula collision within the row and column axis result area.
My question is will Cell Editor meet our requirement if we want to get formula results from the row and column axis and then display the results outside of the row and column axis result area?
Our approach was to use the Excel cell formulas in the workbook or possibly macros, but it seems that the Excel formulas will do.
Would someone clarify about the Cell editor for this requirement and how would you approach this?
Would this be effective to do the formulas from the query level? We are working on 3.5 SP11.Can Cell editor do the following:
1. Create structures
2. Run the query
3. The results of the structures are displayed in the row and column axis of the BEx Analyzer
4. Save as a workbook
5. Use the Cell Editor to pick and choose the cells (Not the Excel cells) to create formulas
6. The formula results are then displayed outside of the row and column axis.
Would this be another approach?
What scenario can Cell editor be used? What scenario can Cell editor not be used?
Thanks -
I have table having below records.
empno ename deptno
101 a 10
102 b 20
103 c 10
104 d 20
105 e 30
Normal Output using Group by.
deptno count(*)
10 2
20 2
30 1
I want to display like below(rows into columns)
Requiredl Output
10 20 30
2 2 1
Deptnos are in first row and cout of deptno nos are second row.Check out this thread from the FAQ: {message:id=9360005}
-
How to Align Query output in vertical grids in Classic Reports
HI all,
I have a requirement to display query output in a vertical grid.
For example, If my query output is :
SQL, PL/SQL, Forms,Reports, XMLP, APEX etc then output should be displayed in following format:
1. SQL 2. PL/SQL 3. Forms
4. Reports 5. XMLP 6. APEX
Thanks in Advance!!
Regards,
Vamsi866010 wrote:
Thanks for the response!!
SQL: select * from emp
where 1=1
and emp = 1 ;
We want to display emp details from the above query in the following format:
EMP No : 1 Ename: XXX Manager_Id: 2
Job: Consultant Sal: 1000 Commission: 5
We want a break after three columns.Create a custom named column template and base the tabular form report on this: {message:id=10399762}
Please read the FAQ and forum sticky threads (if you haven't done so already), and update your forum profile with a real handle instead of "866010".
When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
<li>Full APEX version
<li>Full DB/version/edition/host OS
<li>Web server architecture (EPG, OHS or APEX listener/host OS)
<li>Browser(s) and version(s) used
<li>Theme
<li>Template(s)
<li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand. -
I have a requirement in report,
It should display totals in row and column wise,
Group open Close Total
A 10 5 15
B 15 10 25
Total 25 15 40
Thanks,
SriniSend me the template and xml file to [email protected] and I will take a look.
Thanks,
BIPuser
Maybe you are looking for
-
I posted a message over a year ago with no luck, and wanted to see if a second posting would give any advice. In short, my PC freezes randomly, with no predictability or triggering events. The only thing that happens is the system locks up, the mous
-
I've been having problems with my Powerbook freezing, sort of as if it were running into memory limits. It began happening mostly when I was using Photoshop (whether other apps were open or not), but it's started also happening when I'm only running
-
Restriction of One Contract per Requisition
Good day! Here's our scenario: we have created a PR for sub-con service. Then we created a contract with reference to this PR. Then proceeded with the PO and Service entry. After that, we discovered that another contract can be created using the same
-
Application address book cancelled restart
I'm having an issue where quiting mail causes it to quit, then relaunch within twenty seconds and when choosing the restart command to restart the computer, address book launches and appears to interact with mail and I get the following error message
-
How to refresh iTunes Match on the iPhone?
Hello, I have around 12.000 songs on my iTunes AND iTunes Match (all have been matched / uploaded, no leftovers). When I turn on iTunes Match on my iPhone, it shows only 4200 tracks, not all the 12k. "Ok, let's turn off iTunes Match on the iPhone and