Howto use formula columns in matrix reports
Hello
How can i use a formula column in matrix report whose function would be
Formula_Column_Result=A-B where A=Cell A
B =Cell B
Regards
Fahad
Hii guys
I solved my problem on my own.
i wrote
SELECT * FROM EMP WHERE EMP.DEPTNO=P_DEPT_NO
and it worked.
Thanks guys..i luv this forum
Regards
Fahad Hameed
Similar Messages
-
Formula Column in Matrix Report (Running Balance)
Hi all. I hope somebody can help me.
I am working on a matrix report using multi-query data models. The report has 2 groups in the horizontal axis and 3 groups in the vertical axis. The intersection is not just a single row but may consist of multiple rows.
My problem is this. I want to create a column in the intersection which is obtained by using a column value from the lowest group in the vertical axis and a summary column obtained from the rows of the intersection.
Here's what my report looks like:
2002 (accross)
2002(down) january february (accross)
January (down) payments balance payments balance
loan #1 10,000 500 9,000 200 8,800
500
loan #2 5,000 100 4,900 200 4,700
February
loan #3 3,500 0 3,500 50 3,450
loan #4 4,200 0 4,200 0 4,200
As you can see, the loans are grouped by month and year. And the payments are grouped for the month and year too.
The data model is :
For Query 1 (Vertical Axis),
1st group - Loan Yr
2nd group - Loan Mo
3rd group - Loan # and amount
For Query 2 (Horizontal Axis)
1st group - Payment Yr
2nd group - Payment Mo
Intersection Group - Payment Amount
My problem actually is how to compute for the running balance of the loan for each month in the horizontal axis. Ive already created a cross product summary to get the running total of the payments made for the month. I tried creating a formula column to for the running balance by subtracting it from the loan amount but i get the error "incompatible frequency"
I hope i have described my problem well and thanks for the helpThe problem is that you're trying to reference dimension columns(loan Amount) in the calculation of matrix cell values. You can only reference other matrix cell values or cross product columns (summary, formula, placeholders) when calculating matrix cell values. Try moving the (loan Amount) column down to the matrix cell - something like:
For Query 1 (Vertical Axis),
1st group - G_LoanYear(LoanYr)
2nd group - G_LoanMonth(LoanMo)
3rd group - G_LoanNumber(Loan#)
For Query 2 (Horizontal Axis)
1st group - G_PaymentYear(PaymentYr)
2nd group - G_PaymentMonth(PaymentMo)
Intersecion /Detail Group - G_Details(PaymentAmount, LoanAmount)
Then create the following Matrix summary columns:
A running summary - CS_Payments:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber G_PaymentYear G_PaymentMonth
- Source: PaymentAmount
- Function: Sum
- Reset At: G_LoanNumber
The total amount per loan - CS_TotalPayment:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber
- Source: LoanAmount
- Function: First
- Reset At: G_LoanNumber
The value of the loan after each payment - CF_Countdown:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber G_PaymentYear G_PaymentMonth
- PL/SQL Formula:
function CF_CountdownFormula return Number is
begin
return(:CS_TotalPayment - :CS_Payments);
end;
You should then be able to display "CF_Payments" and "CF_Countdown" in the matrix cell to show how much has been paid and how much is still owed.
You can still have another "loan amount" as a dimension column - you just don't need to use it when calculating the values in the cell. -
Can we use formula column in lexical parameter in sql query ...
hi
can we use formula column in lexical parameter in sql query ...
as example
i want to give
select * from & c_table
forumula
function c_table
if :p_sort = 1 then
return 'dept'
else
return 'emp'
end;
c_table formula column
is this possible ...
i have such example in oracle apps reports
if i try in ordinary report usinf emp table it show error ..
how we can give formula column...
please help me in this regard...
Edited by: 797525 on Feb 20, 2012 9:31 PMthanks sir,
iam not exactly saying select * from &c_table but some thing that like columns in select stmt also will be populated in user_parameters ,there are lot of table select.......from mtl_demand md, mtl_system_items msi, mtl_txn_source_types mtst, mtl_item_locations loc &C_source_from &C_from_cat
&c_source_from and &c_from_cat formula column and there are defined at report level only ......
pl/sql code &c_source_from is
function C_source_fromFormula return VARCHAR2 is
begin
if :P_source_type_id = 2 then return(',MTL_SALES_ORDERS mkts');
else if :P_source_type_id = 3 then return(',GL_CODE_COMBINATIONS gl');
else if :P_source_type_id = 6 then return(',MTL_GENERIC_DISPOSITIONS mdsp');
else if :P_source_type_id = 5 then
if :C_source_where is null then
return NULL;
else
return(',WIP_ENTITIES wip');
end if;
else if :P_source_type_id = 8 then return(',MTL_SALES_ORDERS mkts');
else if :P_source_type_id is null then
return(',MTL_SALES_ORDERS mkts,
MTL_GENERIC_DISPOSITIONS mdsp,
GL_CODE_COMBINATIONS gl ');
else null;
end if; end if; end if; end if; end if; end if;
RETURN NULL; end;
this is forumula column i hope that you understand what iam saying
please help me in this regard....
thanking you... -
How to add a formula column in a report
Hi
I have made a report based on a query.
There are 3 columns in the query and all the 3 are displayed.
Now I want to add a new column (fomula column) to the report.
I want to write a query inside the formula column. To execute the query col1, col2 and col3 values are required in the formula column.
Could you please tell me how to add a formula column in the report and how to pass database column value to inside the formula column
regardsHere is how you would create a formula column:
Open data model of the report.
Formula column button is on the left side of the tool palette.
Click on that button.
Now click in the query group where you want to place the formula column.
You would see a new field something like CF_1. That is the formula column.
Double click on the field CF_1. It will open property inspector.
You would see, Datatype of the formula column is Number. Change this as per your requirement.
Double click on PL/SQL Formula property. It would open up a editor. Here you can write the code.
And now to access the data model column here, you can use : and column name. i.e. :col1 or :col2, etc
And remember you have to return the value back to the formula column. Like this: RETURN(some value).
You can also take a help from here:
http://download.oracle.com/docs/html/B13895_01/orbr_howto.htm#sthref1309
Hope this helps. -
About formula column in oracle report
I want the output value of the formula column in my report between two brackts ....ex: (28.99) ...can anyone give me the idea
Do u mean that brackets have to be appeared only when the value is +ve/-ve. then you need to use (9999) in the format mask of the property pallette of the text column. if you want to use the brackets for all the data, then the solution has been provided by many of our frnds.
-
Using PL/SQL in a formula column in Oracle Reports Builder.
Hi,
I need to SUM two record from the result of an SQL interrogation.
Here's what it looks like
function CF_1Formula return Number is
nTot1 NUMBER :=0;
nTot2 NUMBER :=0;
begin
select sum(:TOT1) into nTot1 from table(Q1) ;
select sum(:TOT2) into nTot2 from table(Q1) ;
return (nTot1 + nTot2);
end;I'm kind of new to formula column programming any link of interest would be appreciated.
The from table(Q1) part Q1 represents my SQL interrogation name and the group below it is G_MAIN.Hi Hong Kong King Kong,
From looking at that function name (and the group name): Is this an Oracle Reports generated function?
If so, there's also a dedicated Reports forum: Reports
By the way, I like your synonym for 'query'.
I'm sure I'll confuse some of my collegues tomorrow when I will mention 'database interrogation' instead of 'query'. ;)
edit
Doh...I should not underestimate the information that is posted in thread subjects.
Edited by: hoek on May 5, 2010 9:24 PM -
Formula Columnn in Matrix Report (Running Balance)
Hi all. I hope somebody can help me.
I am working on a matrix report using multi-query data models. The report has 2 groups in the horizontal axis and 3 groups in the vertical axis. The intersection is not just a single row but may consist of multiple rows.
My problem is this. I want to create a column in the intersection which is obtained by using a column value from the lowest group in the vertical axis and a summary column obtained from the rows of the intersection.
Here's what my report looks like:
2002 (accross) 2003
januar february (accross
payments balance paymenst balance
2002 (down)
Januar (down)
Loan#1 10,000 500 9000 200 8800
500
Loan#2 5000 100 4900 200 4700
February
Loan#3 3500 0 3500 50 3450
Loan#4 4200 0 4200 0 4200
As you can see, the loans are grouped by month and year. And the payments are grouped for the month and year too.
The data model is :
For Query 1 (Vertical Axis),
1st group - Loan Yr
2nd group - Loan Mo
3rd group - Loan # and amount
For Query 2 (Horizontal Axis)
1st group - Payment Yr
2nd group - Payment Mo
Intersecion /Detail Group - Payment Amount
My problem actually is how to compute for the running balance of the loan for each month in the horizontal axis. Ive already created a cross product summary to get the running total of the payments made for the month. I tried creating a formula column to for the running balance by subtracting it from the loan amount but i get the error "incompatible frequency"
I hope i have described my problem well and thanks for the helpThe problem is that you're trying to reference dimension columns(loan Amount) in the calculation of matrix cell values. You can only reference other matrix cell values or cross product columns (summary, formula, placeholders) when calculating matrix cell values. Try moving the (loan Amount) column down to the matrix cell - something like:
For Query 1 (Vertical Axis),
1st group - G_LoanYear(LoanYr)
2nd group - G_LoanMonth(LoanMo)
3rd group - G_LoanNumber(Loan#)
For Query 2 (Horizontal Axis)
1st group - G_PaymentYear(PaymentYr)
2nd group - G_PaymentMonth(PaymentMo)
Intersecion /Detail Group - G_Details(PaymentAmount, LoanAmount)
Then create the following Matrix summary columns:
A running summary - CS_Payments:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber G_PaymentYear G_PaymentMonth
- Source: PaymentAmount
- Function: Sum
- Reset At: G_LoanNumber
The total amount per loan - CS_TotalPayment:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber
- Source: LoanAmount
- Function: First
- Reset At: G_LoanNumber
The value of the loan after each payment - CF_Countdown:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber G_PaymentYear G_PaymentMonth
- PL/SQL Formula:
function CF_CountdownFormula return Number is
begin
return(:CS_TotalPayment - :CS_Payments);
end;
You should then be able to display "CF_Payments" and "CF_Countdown" in the matrix cell to show how much has been paid and how much is still owed.
You can still have another "loan amount" as a dimension column - you just don't need to use it when calculating the values in the cell. -
How to make an order on repeating frame using Formula Column?
Hi All,
I have a repeating frame dependent on some query, how to make an order on this repeating frame using a formula column defined in its group and dependet on values from the query?
Note: I'm using Reports 6iPlace your formula column at the top of the itm group and set the BREAK_ORDER to assc.. or desc...
Hope this helps
Hamid
if problem solved, close the thread. -
Hi all
I create matrix report( in version 9i)
I want sort columns of report
when i use order by it sort rows but i want sort columns
my query is like this:
SELECT
Code,
name,
DECODE(cons_code, '1', 'A',
'2', 'B',
'3','C',
'4', 'D',
'5', 'E') Activity,
SUM(amnt) amount
From Mytable
Where ....
group by
Code,
DECODE(cons_code, '1', 'A',
'2', 'B',
'3','C',
'4', 'D',
'5', 'E')
my group base on code
my columns base on Activity
and cells are Amount
my report result is:
........ B E D A C
name1 1 1 1 1 2
name2 3 4 8 6 1
I want this :
........ A B C D E
name1 1 1 1 1 2
name2 3 4 8 6 1
....Hello,
How about this?
SELECT Code, name,
DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D','5', 'E') Activity, SUM(amnt) amount
From Mytable
WHERE ....
GROUP BY Code, name, DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D', '5', 'E')
ORDER BY code, DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D', '5', 'E') -
SSRS 2005 - Dynamically control the width of columns in Matrix report or Hide any column
Hi All,
I just want to hide some column without having white space in Matrix report in SSRS 2005. Although I am aware of that perhaps this feature is not available on SSRS 2005. So, I just want to know if we can handle the width of column dynamically(using expressions)
in matrix report?
Please help. Thanks in Advance.
Regards
KumudHi Kumud,
Based on my test, SSRS is not support column dynamically width. It has property “CanGrow” of text box. If we configure the property to True, it will wraps to next line if needed. In SSRS 2008, we can hide some columns without white space. If possible, I
recommend you update your SSRS 2005 to SSRS 2008.
There is a similar issue, you can refer to it.
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/9e6043f1-c458-4540-be59-d37b02feab8a/dynamic-column-width-for-a-report?forum=sqlreportingservices
Alternatively, I recommend you that submit a wish to the Microsoft Connect at
https://connect.microsoft.com/SQLServer/Feedback. Your feedback is valuable for us to improve our products and increase the level of service provided.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
I've tried several ways of doing this, and this seems to be the easiest way. Basically, depending on the type of record, I need to use one of two columns to link to another query. So, if a row in query A has type 1, I need to use column X to link to query B. If a row in query A has type 2, I need to use column Y to link to query B.
I thought the easiest way to do this would be to create a formula column in Query A that was the value of column X or Y as appropriate and then link to Query B using this formula field. However, I can't seem to link queries using a formula.
Does anyone have any ideas how I can accomplish this? I'm new with Oracle reports, so go easy on me :)
Thanks,
Julie.What error are you getting?
Is it: REP-1297: Data link child column 'CF_1' must be a database column?
If so, the reason is the child column cannot be a formula column. The parent column, on the other hand, can be a formula column.
If I understand your data model correctly, "A" is your parent query/group and "CF_1" is the formula column in query/group "A".
"B" is your child query. "FK_1" (the foreign key column in query "B") is your child column.
You should be able to link "CF_1" in "A" to "FK_1" in "B" by doing:
- click on the link tool
- click on "CF_1" in "A"
- drag to "FK_1" in "B"
- A link should be created. Double click on it to bring up the property palette for that link and you'd see the link properties.
Hope that helps... -
: HIDING SUMMARY COLUMNS IN MATRIX REPORT , URGENT
Hi,
Can any one please tell me how to hide a column in oralce matrix report. Its a summary column for the matrix report which appears next to the cell values. For example
Manufacturer
Brand
SubBrand1 SubBrand2 Brand Total Manufacturer Total
Week $ Sales $ Sales Total $ Sales Total $ Sales
This is a case where,the cell value is the $ sales for the SubBrand for the week. And it gets total at each brand level and each Manufacturer level. The requrement is if there is only one SubBrand for a Brand then the Brand total should not appear on the report. Similarly if there is one Brand for a Manufacturer, then the total at Manufacturer level should not appear . The point is not only it should dissapear but the frame should srink to make it fell that there is no totaling going on at those two levels. If the fileds just remains blank then the report looks odd. So the gap should be srinked as well. How to do it . This is very urgent . Please help me out.
Thanks
Ferozuse a formst trigeer on the field that returns false when you don't want to display the field.
-
Display null rows / columns in matrix report
Hi,
Is it possible to display any character ('0' for example) in a matrix report where the entire row or column show no value at all ?
My matrix shows Row1 and Row2 with values but no Row3 at all like this:
Column1 Column2 Column3
Row1 value1 value2 value3
Row2 value4 value5 value6
But I would like it to show my rows 3 with '0's :
Column1 Column2 Column3
Row1 value1 value2 value3
Row2 value4 value5 value6
Row3 0 0 0
Thank you,
DeniseMake your query return 0 with nvl(column, 0) and an outer join, plus some stuff to avoid a double outer join.
E.g. a sales per product per city:
City1 City2 City3
Prod1 10 100 12
Prod2 25 110 200
Prod3 0 0 0Could be made like this:
create table city (c_city varchar2(10));
create table prod (p_prod varchar2(10));
create table prod_sales (ps_city varchar2(10)
, ps_prod varchar2(10)
, ps_sales number);
<.....insert some values, except voor Prod3 .....>
SQL> select p_prod, c_city, nvl(ps_sales,0)
2 from (select c_city, p_prod from city, prod)
3 , prod_sales
4 where ps_city(+) = c_city
5 and ps_prod(+) = p_prod
6 order by 1,2 ;
P_PROD C_CITY NVL(PS_SALES,0)
Prod1 City1 10
Prod1 City2 100
Prod1 City3 12
Prod2 City1 25
Prod2 City2 110
Prod2 City3 200
Prod3 City1 0
Prod3 City2 0
Prod3 City3 0 -
How to use formula column,placeholder column in data template option
Hi All,
Can you some idea on these concept with example.
Thanks in adv>
formula column,placeholder column
>
it's oracle reports terms?
http://oraclebizint.wordpress.com/2007/08/22/oracle-reports-to-bi-publisher-conversion-utility/
http://eoracleapps.blogspot.ru/2009/04/how-to-convert-oracle-reports-in-bi.html
so convert your oracle reports to bi publisher and you'll see mapping for your case -
Use Formule on FORM with REPORT - result stored at table
Hi all,
What is the best solution for?
I have region with FORM WITH REPORT on the same PAGE.
Values stored at table INFO with column ID, MYDATE, TIME_START_HOUR, TIME_START_MIN, TIME_END_HOUR, TIME_END_MIN, SUM1, SUM2
ITEMS on the form:
P1_ID (hidden)
P1_MYDATE (date picker)
P1_TIME_START_HOUR (select list)
P1_TIME_START_MIN (select list)
P1_TIME_END_HOUR (select list)
P1_TIME_END_MIN (select list)
P1_SUM1 (hidden)
P1_SUM2 (hidden)
After user fill in MYDATE, TIME_START_HOUR, TIME_START_MIN, TIME_END_HOUR, TIME_END_MIN then I need proces for calculation SUM1 en SUM2. Result stored (one record) at table INFO.
Report shows all columns. User had possibility to update the record
Formule:
Select
(CASE
when to_char(mydate,'DY','nls_date_language=dutch') in ('ZA','ZO')
THEN substr(to_timestamp (mydate||':'||TIME_END_HOUR||':'||TIME_END_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
to_timestamp (mydate||':'||TIME_START_HOUR||':'||TIME_START_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
(interval '00 00:00:00' day to second)
,12,5)
ELSE '08:00'
END) SUM1,
(CASE
when to_char(mydate,'DY','nls_date_language=dutch') in ('ZA','ZO')
THEN substr(to_timestamp (mydate||':'||TIME_END_HOUR||':'||TIME_END_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
to_timestamp (mydate||':'||TIME_START_HOUR||':'||TIME_START_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
(interval '00 04:00:00' day to second)
,12,5)
ELSE '04:00'
END) SUM2
FROM INFO
where id=:ID
What is the best way for the calculation: computation or processes or etc? The calculation after or before user push button(New:create button of Update:Apply Changes)?
How to fill the answer (SUM1 and SUM2) at table INFO?
Thanks WalterI have something similar I use:
DECLARE
str_day VARCHAR2(10);
dt_indx DATE;
db_dt_indx VARCHAR2(20);
str_st_tm VARCHAR2(20);
dt_st_tm DATE;
db_st_tm VARCHAR2(20);
str_ed_tm VARCHAR2(20);
dt_ed_tm DATE;
db_ed_tm VARCHAR2(20);
shft_flag NUMBER;
BEGIN
str_day := :P1050_DATE_MM || '/' || :P1050_DATE_DD || '/' || :P1050_DATE_YYYY;
dt_indx := to_date(str_day, 'MM/DD/YYYY');
db_dt_indx := to_char(dt_indx, 'MM/DD/YYYY');
str_st_tm := str_day || ' ' || :P1050_TIME_IN_HH || ':' || :P1050_TIME_IN_MI || ' ' || :P1050_TIME_IN_AM;
dt_st_tm := TO_DATE(str_st_tm, 'MM/DD/YYYY HH:MI AM');
str_ed_tm := str_day || ' ' || :P1050_TIME_OUT_HH || ':' || :P1050_TIME_OUT_MI || ' ' || :P1050_TIME_OUT_AM;
dt_ed_tm := TO_DATE(str_ed_tm, 'MM/DD/YYYY HH:MI AM');
--Alter date if night shift
SELECT NVL(:P1050_NIGHT_FLAG,0) into shft_flag from dual;
IF dt_ed_tm < dt_st_tm THEN
dt_ed_tm := dt_ed_tm + 1;
END IF;
db_st_tm := to_char(dt_st_tm + shft_flag,'MM/DD/YYYY HH:MI AM');
db_ed_tm := to_char(dt_ed_tm + shft_flag,'MM/DD/YYYY HH:MI AM');
end;You'll need to modify it for your page variables.
Maybe you are looking for
-
Please give me some sample program releated BOM
please give me some sample program releated BOM
-
Counting fact table records within brackets
Hi, I have a star schema setup in OBIEE, consisting of a fact table of transaction records, linked to a customer dimension and a time dimension via PK-FK relations. One of the requirements is to count the number of customers based on how many transac
-
Mail randomly choosing which messages to display
I have a problem with the desktop version of Mail, where it randomly stops displaying message content. A message will come in, but when i click on it nothing displays in the window. Quitting and re-booting the application solves this, but it means qu
-
Need authorisation list for BW modelling ,extraction and reporting
Hi all gurus, I am about to work in an BI implementation project and I need a list of Authorizations that I have to submitt to the basis people. Can anyone help me out with this. Thanks in advance, VM.
-
Check if a value on form was changed
Hi Friends, 1. I display an object (a set of attributes) on an editable adf form. 2. User can modify values on the form. 3. 'Reset' button is provided to reset changes done by user. Q? --> When user clicks on 'Reset', I would like to check if user ch