Dynamic Result of 2 columns by 3 columns
Hi @ all,
my question is a little bit suspect, but I hope you can help me!
In my query I want to show a dynamic result which should show the result of the shown columns.
I still have a structure with 3 selections in my query columns. If I show all selections in query the result should be show the sumation of all the columns. If I show only 2 selections in the structure the result should be only the sum of the 2 selections.
Here an example:
column1 column2 column3
result
100 200 150 450
by changing the coumns...:
column1 column3 result
200 150 350
Thanks for your answers!!
Heiko
Edited by: Heiko Görlich on Dec 20, 2007 9:54 AM
Maybe I'm little be confused, but I willl show you my query definition:
*********CH2**************
SEL1 SEL2 SEL3 Formula(SEL1SEL2SEL3)
CH11 KF1 100 200 150 450
KF2 70 30 200 300
CH12 KF1 500 150 100 750
KF2 40 10 500 550
Legend:
SEL = Selection in Structure
CH1 = Characteristic1
CH2 = Characteristic2
KF1 = KeyFigure1
The 3 Selections are my structure. There is no way toy say suppress results row always. Only in CH2 you can say it.
Did I define a wrong sumation in my formula?
Similar Messages
-
How to generate report with dynamic variable number of columns?
How to generate report with dynamic variable number of columns?
I need to generate a report with varying column names (state names) as follows:
SELECT AK, AL, AR,... FROM States ;
I get these column names from the result of another query.
In order to clarify my question, Please consider following table:
CREATE TABLE TIME_PERIODS (
PERIOD VARCHAR2 (50) PRIMARY KEY
CREATE TABLE STATE_INCOME (
NAME VARCHAR2 (2),
PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD) ,
INCOME NUMBER (12, 2)
I like to generate a report as follows:
AK CA DE FL ...
PERIOD1 1222.23 2423.20 232.33 345.21
PERIOD2
PERIOD3
Total 433242.23 56744.34 8872.21 2324.23 ...
The TIME_PERIODS.Period and State.Name could change dynamically.
So I can't specify the state name in Select query like
SELECT AK, AL, AR,... FROM
What is the best way to generate this report?SQL> -- test tables and test data:
SQL> CREATE TABLE states
2 (state VARCHAR2 (2))
3 /
Table created.
SQL> INSERT INTO states
2 VALUES ('AK')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('AL')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('AR')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('CA')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('DE')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('FL')
3 /
1 row created.
SQL> CREATE TABLE TIME_PERIODS
2 (PERIOD VARCHAR2 (50) PRIMARY KEY)
3 /
Table created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD1')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD2')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD3')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD4')
3 /
1 row created.
SQL> CREATE TABLE STATE_INCOME
2 (NAME VARCHAR2 (2),
3 PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
4 INCOME NUMBER (12, 2))
5 /
Table created.
SQL> INSERT INTO state_income
2 VALUES ('AK', 'PERIOD1', 1222.23)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('CA', 'PERIOD1', 2423.20)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('DE', 'PERIOD1', 232.33)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('FL', 'PERIOD1', 345.21)
3 /
1 row created.
SQL> -- the basic query:
SQL> SELECT SUBSTR (time_periods.period, 1, 10) period,
2 SUM (DECODE (name, 'AK', income)) "AK",
3 SUM (DECODE (name, 'CA', income)) "CA",
4 SUM (DECODE (name, 'DE', income)) "DE",
5 SUM (DECODE (name, 'FL', income)) "FL"
6 FROM state_income, time_periods
7 WHERE time_periods.period = state_income.period (+)
8 AND time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
9 GROUP BY ROLLUP (time_periods.period)
10 /
PERIOD AK CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
1222.23 2423.2 232.33 345.21
SQL> -- package that dynamically executes the query
SQL> -- given variable numbers and values
SQL> -- of states and periods:
SQL> CREATE OR REPLACE PACKAGE package_name
2 AS
3 TYPE cursor_type IS REF CURSOR;
4 PROCEDURE procedure_name
5 (p_periods IN VARCHAR2,
6 p_states IN VARCHAR2,
7 cursor_name IN OUT cursor_type);
8 END package_name;
9 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY package_name
2 AS
3 PROCEDURE procedure_name
4 (p_periods IN VARCHAR2,
5 p_states IN VARCHAR2,
6 cursor_name IN OUT cursor_type)
7 IS
8 v_periods VARCHAR2 (1000);
9 v_sql VARCHAR2 (4000);
10 v_states VARCHAR2 (1000) := p_states;
11 BEGIN
12 v_periods := REPLACE (p_periods, ',', ''',''');
13 v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
14 WHILE LENGTH (v_states) > 1
15 LOOP
16 v_sql := v_sql
17 || ',SUM(DECODE(name,'''
18 || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
19 || '"';
20 v_states := LTRIM (SUBSTR (v_states, 3), ',');
21 END LOOP;
22 v_sql := v_sql
23 || 'FROM state_income, time_periods
24 WHERE time_periods.period = state_income.period (+)
25 AND time_periods.period IN (''' || v_periods || ''')
26 GROUP BY ROLLUP (time_periods.period)';
27 OPEN cursor_name FOR v_sql;
28 END procedure_name;
29 END package_name;
30 /
Package body created.
SQL> -- sample executions from SQL:
SQL> VARIABLE g_ref REFCURSOR
SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
1222.23 2423.2 232.33 345.21
SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK AL AR
PERIOD1 1222.23
PERIOD2
1222.23
SQL> -- sample execution from PL/SQL block
SQL> -- using parameters derived from processing
SQL> -- cursors containing results of other queries:
SQL> DECLARE
2 CURSOR c_period
3 IS
4 SELECT period
5 FROM time_periods;
6 v_periods VARCHAR2 (1000);
7 v_delimiter VARCHAR2 (1) := NULL;
8 CURSOR c_states
9 IS
10 SELECT state
11 FROM states;
12 v_states VARCHAR2 (1000);
13 BEGIN
14 FOR r_period IN c_period
15 LOOP
16 v_periods := v_periods || v_delimiter || r_period.period;
17 v_delimiter := ',';
18 END LOOP;
19 v_delimiter := NULL;
20 FOR r_states IN c_states
21 LOOP
22 v_states := v_states || v_delimiter || r_states.state;
23 v_delimiter := ',';
24 END LOOP;
25 package_name.procedure_name (v_periods, v_states, :g_ref);
26 END;
27 /
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK AL AR CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
PERIOD4
1222.23 2423.2 232.33 345.21 -
Not able to see the result in particular column of BPC report
Dear All,
I have problem in one of the BPC report where I am not able to see the result into one column but rest of the users are able to see the result for same column in same report without any issues.
Generally, I used this report frequently but having such problem from last few days. Excel has created any logs which I need to clear? Please advice.
Request your help to resolve such problem please.
If you need any information, please let me know.
Thank You
Kind Regards
AnukulHello Anukul,
In the report what type of data you are trying to check in that column. can you please brief about report.
And also please check the excel cell format (right click and check it is a numeric or character), which may help to resolve this issue.
Regards,
Rajesh.K -
Store the result of the column in variable in answer
Hi All,
Is there a way to store the value of the result of the column of the report and use that value in calculation in another report. I need to get the grandtotal value which changed according to the prompt and want to use that grand total value to calculate new column in another report. Can we use presentation variable? I want to store the total value 30 and then calculate the region percentage. I am not able to store the total value and create the new column calculation using the total value.
Region 1 10 *0.33*
Region 2 20 *0.67*
Total 30
Thanks,
Virat
Edited by: 872073 on Jan 9, 2013 6:30 AMYou can use this Report as a Subreport in the Final Report,and apply a filter the column=subreport.columnvalue.
-
Dynamic Table with two columns
Hi!
i have to create a Dynamic Table with two columns having 5-5 links each with some text...... three links r based on certain conditions....they r visible only if condition is true...
if the links r not visible in this case another links take it's place & fill the cell.
links/text is coming from database.
i am using Struts with JSP IDE netbeans
Please help me
BuntyIndiai wanna do something like this
<div class="box_d box_margin_right">
<ul class="anchor-bullet">
<c:forEach items="${data.faqList}" var="item" varStatus="status"
begin="0" end="${data.faqListSize/2-1}">
<li>${item}</li>
</c:forEach>
</ul>
</div>
<div class="box_d">
<ul class="anchor-bullet">
<c:forEach items="${data.faqList}" var="item" varStatus="status"
begin="${data.faqListSize/2}" end="${data.faqListSize}">
<li>${item}</li>
</c:forEach>
</ul>
</div>
wanna divide table in two columns....if one link got off due to condition other one take it's position...
I have created a textorderedlist
Bunty -
Dynamic name in formula column header
Greetings, i have a question - is it possible to create dynamic header of formula column?
For example - year on the form is 2012? in the header i want something like ratio "current year picked from forms year" to "current year -1", i.e. ratio 2012 to 2011
Is it possible?It looks like forms are not supporting text functions like FR yet, I gave it a try <<MemberName("<Formname>","<POV DIM Name>)>> in the formula header area and it didn't like it. It is just displaying what ever I typed in there.
-
Percentage based on two result of the columns
Hi all,
My report loos like
Type posting order Number of records Date diff %
A 1 1 1
A 2 1 1
A 3 1 1
Result 3 3 100%
B 1 1 1
B 2 1 1
B 3 1 0
Result 3 2 66%
As u can see that i need to calculate the percentage based on the result of two columns.
Can u please throw some light ..
Watin for reply
Thanks
BabuHi Babu,
I think your example is not totally clear. From what I understand, you need to calculate a result in percentage based on the result of two other columns. What you can do is to use the first result (from the two columns) as a CKF. And then, to this CKF, use the result calcultation options of the query desinger for percentage.
Hope this helps.
Regards,
Diego -
How to clone data with in Table with dynamic 'n' number of columns
Hi All,
I've a table with syntax,
create table Temp (id number primary key, name varchar2(10), partner varchar2(10), info varchar2(20));
And with data like
insert itno temp values (sequence.nextval, 'test', 'p1', 'info for p1');
insert into temp values (sequence.nextval, 'test', 'p2', 'info for p2');
And now, i need to clone the data in TEMP table of name 'test' for new name 'test1' and here is my script,
insert into Temp select sequence.nextval id, 'test1' name, partner, info from TEMP where name='test1';
this query executed successfully and able to insert records.
The PROBLEM is,
if some new columns added in TEMP table, need to update this query.
How to clone the data with in the table for *'n' number of columns and*
some columns with dynamic data and remaining columns as source data.
Thanks & Regards
PavanPinnu.
Edited by: pavankumargupta on Apr 30, 2009 10:37 AMHi,
Thanks for the quick reply.
My Scenario, is we have a Game Details table. When ever some Game get cloned, we need to add new records in to that Table for the new Game.
As, the id will be primary key, this should populate from a Sequence (in our system, we used this) and Game Name will be new Game Name. And data for other columns should be same as Parent Game.
when ever business needs changes, there will be some addition of new columns in Table.
And with the existing query,
insert into Temp (id, name, partner, info) select sequence.nextval id, 'test1' name, partner, info from TEMP where name='test'_
will successfully add new rows but new added columns will have empty data.
so, is there any way to do this, i mean, some columns with sequence values and other columns with existing values.
One way, we can do is, get ResultSet MetaData (i'm using Java), and parse the columns. prepare a query in required format.
I'm looking for alternative ways in query format in SQL.
Thanks & Regards
PavanPinnu.
Edited by: pavankumargupta on Apr 30, 2009 11:05 AM
Edited by: pavankumargupta on Apr 30, 2009 11:05 AM -
IP: Dynamic Data and Lead Columns
Hello,
In IP, there is not such thing as "Dynamic Data and Lead Columns" which we have used successfully in BPS. We have quite normal case where accounts are on rows and columns are defined as follows:
Column 1): KF Qty1, Period #, Year "Var Current year (single value)"
Columns 2-n): KF Amt1, Period "Var periods current year (multiple values)", Year "Var Current year"
Column n+1): Sum columns 2-n
Number of periods in variable "Var periods current year" is not fixed and maintained by superuser, so number of columns is somewhere between 3 and 14 (at least one open period, maximum 12, plus the Qty1 and Sum columns).
How would you fix this in IP?
Thanks for answers!
AkiHello Aki,
you could put the period into the columns as char.
if you make a selection to value # and the variable you will se as many columns as periods are selected in the variable plus the one column for #.
regards
Cornelia -
Save a dynamic sql into a column
Hello,
I need to save dynamic SQL into a column called STR in a table.
I have a insert into table A( id, fname, lname)
values(1, 'John', 'Smith');
I have a requirement to save the DML statement that user executed such as this insert statement into table 'A'.
I have to save this into anoter table called 'B' in the 'STR' column.
I have to save that whole insert statement into a cloumn 'STR' in table 'B'
How can do this?
Thank you..This is not for auditing. The shop wants to save the DML statements in a table when a user does updates and inserts.. at the same time they want to build dynamic sql for this as a string such as update emp set where empno = 1 etc....
could you give me an example please.
Thanks a bunch.... -
How can I dynamically change group field column?
Hello!
I need to group data and create group totals for that table. Is
it possible to dynamically change group field column for
specific table, depending on data retreived from parameter form?
Thanks,
Mario.quote:
Originally posted by:
ljonny18
Hi,
I am using a grid within a component in my Flex application.
I have an XML dataProvider, and I want to change the row
colour of my Grid depending on a value coming form my dataProvider
– but I cant seem to get this to work :(
can anyone help / advise me on how I can dynamically change the
colour of my grid row depending on a value coming from my XML
DataProvider????
Thanks,
Jon.
Hi,
a few hours ago I stumbled across this cookbook entry - it
didn't solve MY problem, but maybe it provides a way to solve your
problem?
http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&postId=61&product Id=2&loc=en_US
From the article:
quote:
Changing the background color of a DataGrid cell is not as
simple as changing some style because the default renderer for a
DataGrid cell does not have a backgroundColor. Therefore, to do
this simple task, you have to create a custom itemRenderer where
you draw your own background in the updateDisplayList function.
HTH
Uwe -
How to display MySql query results in multiple columns?
Hi, I know how to display PHP/MySq
l query results in a single column, but I am really stuck at displa
ying the results in multiple columns in DW CS4.
Can anyone help me with a code example?. I am new to php/mysql. ThanksAre you asking how to pivot the results of the query? Do a search for horizontal looping. If that's not what you are asking, please provide more details.
-
How to write a Query a table and the return result is the column name
Hi All
Pls advise how to write a query whereas the return result is the
column name.
I know there is describe <table_name>;
Is there any other ways?
Pls advise
Tj
Edited by: user600866 on Oct 14, 2008 12:13 AMData Dictionary table user_tab_columns has all the column names. You can query that and get what ever you want.
To get the column list of a table just query
select *
from user_tab_columns
where table_name = <your_table>Edited by: Karthick_Arp on Oct 14, 2008 12:18 AM -
Is it posible a query that builds dynamically the number of columns?
Hi experts!
I have a query that shows amounts in 12 columns corresponding on the calendar months of the year. Now, I need to change that getting in a previous screen how many months the user wants to see. The query has to build dynamically the number of columns to show. Can I do that with query designer? How?
I am working in V7.0.
I appreciate your help.
Thanks!
Ada.Hi experts!
I have a query that shows amounts in 12 columns corresponding on the calendar months of the year. Now, I need to change that getting in a previous screen how many months the user wants to see. The query has to build dynamically the number of columns to show. Can I do that with query designer? How?
I am working in V7.0.
I appreciate your help.
Thanks!
Ada. -
Displaying Combined Dynamic Result in Report
Hello,
I am a beginner in Oracle CRMOD, i have some issues in Reporting.
I want to create a report, which displays 2 Columns , where 1st field is Name , 2nd field which has to be displayed according to the length of the name like if Length of name is lesser than5 Characters it should display Lesser - Actual Length of the Name, if it is greater Greater - Actual Length of the Name.
Example:
Richard Greater-7
Rick Lesser-4
Ried Lesser-4
Richardson Greater-10
I want name in one column which comes automatically, the result in another column. I was successful to display the Text Lesser(or Greater) or only the Length. But i am not able to concatenate both the result in one column. I tried + , Cast. But did not find any result.
Can anyone please help me out.
Thanks in AdvanceHai Friends,
I Found out the answer for the question today after so many tries
I am Pasting the Code below
CONCAT
CASE WHEN LENGTH(Account."Account Name") <5
THEN 'Category A, Length = '
ELSE 'Category B, Length = '
END,
CAST(Length(Account."Account Name") AS Char)
Thanks
Maybe you are looking for
-
Hp slate 7 voicetab android os not Update
This morning I got a system update on my HP Slate7 Voice Tab for android KitKat 4.4.2. After the download was over, it asked for a system reboot. However, on rebooting, the following image appeared on the screen: I tried doing a factory reset but tha
-
Skip inspection at the time of Goods Receipt
I want to skip inspection since it has been done at source. How can I do it at the time of GR ? I know about activating indicator 'Source Inspection - No GR', but I don't find it in MIGO screen.
-
How do you get your content in front of the right people?
"Outbound Content Marketer of the Year, Joe Chernov (VP of content at HubSpot) told me: Marketers always ask me how to make more or better content, and it’s almost always the wrong question. The right question is: “How do I get my content in front of
-
Production Environment RFC's for EWA.... Please help!!
We have some of the production environment setup EWA. I will need to add else which are left. I have setup EWA in sandbox for testing. worked fine. but i have question about RFC's. My all DEV systems has the following RFC's in solman; SM_XXXCLNT100_L
-
Code Review of User Exits with Code Inspector
Hi, We are using Code Inspector(Tcode - SCI) for checking the quality of ABAP Codes. It is working fine for all custom programs. But when we are checking the code of User Exits i: e MV50AFZ1 or ZXM06U22 then it checks the std SAP program (SAPMV50