Formula Column Addition
Dear All,
I am using BEx Query Designer to make a query.I view the report using browser. I have 2 keyfigure fields "price" and "forecast quantity". I have to arrive at "forecast Value" = price * forecast quantity using formula in Query designer. Although for each material this proves correct in report material wise. If I see the report customer-wise a customer who has bought 10 materials first the prices are added up andthen the forecast quantity is added up and then the sums are multiplied to get forecast value which is wrong.
Illustration :
Quantity Price Value(Quantity * price)
Customer 1 : Material1 2 10 20
Material2 3 10 30
Material3 5 10 50
Material4 7 10 70
Total 17 40 170 = Correct value
But if I see report customer wise I get the value as 17 * 40 = 680 which is wrong.
Is there any way when I see an aggregation of materials the calculation in formula column first multiplies individual rows and then add the rows to give me final value?
Regards,
Ratish
[email protected]
hi Pratish.
Please please I'm in a hurry can you tell me how did you solve this problem?
Please... If you want to, I'll open a post to give you points... please.
Best regards...
Karim
Similar Messages
-
Formula columns delay the formatting
I have my pay roll report developed in matrix format.It was working fine,but with the addition of two formula columns(which in turn call two functions defined at the database level,to derive some additional values)the formatting gets extremely delayed.I cannot perform these calculations in the query itself as it involve some computing based on certain conditions.So how can I make the report run faster?Does having many formula columns decrease the efficiency of report being run?
Thanks
JayTry to perform the query in your report. Include performance hints like /*+ first_rows */ or.. other, Build indexes,
Hope this help,
MCB -
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 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. -
Formula Columns are not working in Reports 10g
Hi,
We converted the reports developed in Reports 6i to Reports 10g. When we run the report in Reports 10g Builder everything works fine. But when we deploy the same report in Oracle Application Server and invoking the report the formula columns are not working ie., the fields/ placeholder columns which are based on the formula column are not displaying any values in the report.
Please, someone help us in this regard.
Thanks & Rgds,
M TWhat version of Reports do you use..???
Greetings... -
How to display a Sum field for a formula column?
Hi,
I need to display a sum for a formula column at the end of report. for example: my formu_col=col_1-col_2
col_1 col_2 formu_col
3 1 2
6 5 1
total:sum(col_1) sum(col_2) sum(formu_col)
now i have sum(col_1) and sum(col_2), but i don't have sum(formu_col)
thanksHi
You may add a summary column in the same data group that you have sum(col_1) and sum(col_2). In that properties of the new column point the source as formu_col.
Hope this helps.
Fouwaaz -
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 -
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. -
Formula Column help please - URGENT
I'm trying to create a formula column as follows:
function NO_REPLIESFormula return Number is
NOREPLY number;
begin
SELECT COUNT(reply) INTO NOREPLY
FROM letters
WHERE reply = 'N'
GROUP BY ltrtype, batch;
RETURN (NOREPLY);
end;
This PL/SQL compiles fine, but when I run the report, I get the following messages:
REP-1401 no_repliesformula FATAL PL/SQL error occured. ORA-01422 exact fetch returns more than requested number of rows.
If I remove the GROUP BY ltrtype, batch, I don't get the error messages, but the result I get is the total no_replies instead of the total no_replies for each ltrtype/batch grouping.
Could someone please help me with this?
Thank you.Hi irish,
I think i am not sure about what you are trying to say, but let me guess, You want the values to be return on the bases of "ltrtype, batch". Which mea that you want more then one values, i mean there can be more then one Groups based on ltrtype and batch. and you want to display these values with repective record???
If i am right, then there is a fault in your code, and that is , you are not specifing in your code that which value is to be diplayed with which record in this report. For that there must be ltrtype, batch colums displayed in the report, you must add those values in your Code in the query, i.e.
function NO_REPLIESFormula return Number is
NOREPLY number;
begin
SELECT COUNT(reply) INTO NOREPLY
FROM letters
WHERE reply = 'N' and ltrtype= :V_ltrtype and batch=:v_batch;
RETURN (NOREPLY);
end;
Where :V_ltrtype and :v_batch are the run time values of each records displayed in the report.
Remember that if you don't sepecify this then your code will return as many records as many distich values of ltrtype, batch. and your variable NOREPLY can hold only one value at a time. I hope you understand both, Solution and the logic behind the error.
Please correct me if i am wrong.
Thanks.
Mohib ur Rehman -
Formula Columns are not appearing in pdf format
hi all,
i have a report that contains some formula columns, the report is running correctly in the report builder, but when running the report through the web as .pdf format all report field appear except those formula columns,
is there anyone who can help me?
M. HammouriWhat version of Reports do you use..???
Greetings... -
Hi,
I wrote the function in formula column, the return value should show in the separate column.
Thx,
BalajiV908509 wrote:
Hi,
I wrote the function in formula column, the return value should show in the separate column.Please provide details when make any question.
What is your report version ?
Choose this formula column as source of item, which display the data on layout view.
Hope understand. -
Formula Column in Report 9i Builder
Hi,
I use this configuration
Report Builder 9.2.0.1.0
Windows XP Service Pack 1
NLS_LANG "BRAZILIAN PORTUGUESE_BRAZIL.WE8ISO8859P1"
When I try to create a formula column that returns number, I have to choose datatype 'Nu'mero' (with accented u)as this is the only avaiable in the combo box. However when I write this PL/SQL code for the column:
function CF_17Formula return Number is
begin
RETURN(1);
end;
Reports gives me the message:
REP-0737: Deve ser uma funcao com retorno do tipo 'nu'mero'.
In English this message could be
REP-0737: Should be a function with return type 'nu'mero'.
I don't have this problem with Character or Date formula columns (these datatypes are called Caracter and Data in Portuguese).
It seems that Reports is having problems with u' (accented u) character. If I change NLS_LANG to AMERICAN_AMERICA.WE8ISO8859P1 everything works fine because I can choose Number in the Formula Column Datatype in the Property Inspector.
The problem is in the function declaration not in the Return statement.
Could anyone help me? Tks.
EdmarEdmar,
You are right. I could reproduce this issue.
I have filed a bug to fix it from the development in next patch
Thanks
The Oracle Reports Team -
Formula Column in Report template
I have a report template to use in all the report. I want to have a formula column on it to take a control value(location/Organization) where the report is being printing. Is it possible to have a formula column in a report template? if it possible how can I do it? otherwise how can i achieve this task?
Thank in advance
Muza.What is the application release?
Can you find any details about the error in the OPP log file?
Please search MOS website for "Cannot view XML input using XSL style sheet" and go through the docs.
Thanks,
Hussein -
Formula column value not updating in table?
Hi all,
I create the sample for master/detail form. In detail for prdcode,rate,qty,amount is there. When select prdcode it fetching prdcode,rate in a record and if you type the qty the amout will come based on formula(property) :qty*:rate.
It is available on screen. But when i store the data, in backend table the amount is be a null.
What is the problem.
Help me in this regards,
kanishHi kanish
Regarding Nul...
-u have to make sure that the formula is working fine and displaying the result in the form screen
-then the item u r storing MUST be a db item >yes and has a column name
-first of all select Help > display_error in the forms runtime may a db item error arais and the record is not correctly saved as u imagined.
u have 2 choices for the solution , i had both before may be it's not very cute but it will work...
1. In when-validate-item Trigger or related item triggers pls follow
SELECT Nvl(( :qty*:rate ) ,0)
INTO :UR_ITEM
FROM DUAL;2.In Pre-Update,Pre-Insert & Pre-Delete Triggers Pls assign the result of ur formula column to the item u want to calc as supposing u r doing the calc of formula in non-db item , then put the following in triggers mentioned ...
: item_name :=:qty*:rate;Hope this helps...
Regards,
Amatu Allah. -
Formula column help needed(urgent)
Hi ,
I am using the data template for generating XML data.
BIP provided functions like SUM(), AVG(), COUNT(), MAX(), etc to use as
below
<group name="G_DEPT" source="Q1">
<element name="DEPT_NUMBER" value="DEPTNO" />
<element name="DEPTSAL" value="G_EMP.SALARY" function="SUM()"/>
<group name="G_EMP" source="Q2">
<element name="EMPLOYEE_NUMBER" value="EMPNO" />
<element name="NAME" value="ENAME"/>
<element name="JOB" value="JOB" />
<element name="SALARY" value="SAL"/>
</group>
</group>
but suppose if I want to do a sum like
Sum(ALLdebits - All credits - All refunds).
We use to have formula good old formula column. like in ORACLE Reports...
below is my query in the data template....can someone please suggest?
<dataTemplate name="R007" dataSourceRef="xyz">
<properties>
<property name="include_rowsettag" value="false"/>
<property name="include_rowtag" value="false"/>
<property name="xml_tag_case" value="as_are"/>
</properties>
<parameters include_in_output="false">
<parameter name="DATE_FROM" dataType="varchar2" include_in_output="false"/>
<parameter name="DATE_TO" dataType="varchar2" include_in_output="false"/>
<parameter name="BANK_GIRO_NUMBER" dataType="varchar2" include_in_output="false"/>
</parameters>
<dataQuery>
<sqlstatement name="Q1">
<![CDATA[SELECT
DISTINCT
SYSDATE todayDate
,substr(trim(CR_BG_NO),3,8) creditorBGNumber
,CREDITOR_SHORT_NAME creditorName
,COUNT(*) itemCount
FROM
R00777_REPORT R1
WHERE
R1.TXN_DATE BETWEEN TO_DATE(:DATE_FROM,'YYYY-MM-DD') AND TO_DATE(:DATE_TO,'YYYY-MM-DD') AND
R1.CR_BG_NO = :BANK_GIRO_NUMBER
GROUP BY
substr(trim(CR_BG_NO),3,8)
,CREDITOR_SHORT_NAME]]>
</sqlstatement>
<sqlstatement name="Q2">
<![CDATA[
SELECT
TXN_DATE
,substr(trim(CR_BG_NO),3,8)
,PAYMENT_TYPE
,TXN_SERIAL_NO
,decode(PAYMENT_TYPE,'AGDEBIT_TRANSFER',DR_TXN_AMOUNT,'AG_REFUND',-RE_TXN_AMOUNT,'AGCREDIT_TRANSFER',-CR_TXN_AMOUNT)
SIGN_AMOUNT
FROM
R00777_REPORT R2
WHERE
R2.TXN_DATE BETWEEN TO_DATE(:DATE_FROM,'YYYY-MM-DD') AND TO_DATE(:DATE_TO,'YYYY-MM-DD')
AND R2.CR_BG_NO = :BANK_GIRO_NUMBER
]]>
</sqlstatement>
</dataQuery>
<dataStructure>
<group name="response" source="Q1">
<group name="head" source="Q1">
<element name="itemCount" value="itemCount"/>
<element name="todayDate" value="todayDate"/>
<element name="creditorBGNumber" value="creditorBGNumber"/>
<element name="creditorName" value="creditorName"/>
</group>
<group name="list" source="Q2">
<group name="listItem" source="Q2">
<element name="transactionDate" value="TXN_DATE"/>
<group name="transactions" source="Q2">
<group name="transaction" source="Q2">
<element name="transactionType" value="PAYMENT_TYPE"/>
<element name="serialNumber" value="TXN_SERIAL_NO"/>
<element name="amount" value="SIGN_AMOUNT"/>
</group>
</group>
<element name="netSum" value="transaction.SIGN_AMOUNT" function="SUM()"/>
</group>
</group>
</group>
</dataStructure>
</dataTemplate>Hi Rainer,
Many Thanks for your reply
I had done all the calculations in the report view earlier
and when i accessed it in the data template as follows
<element name="netSum" value="netSum" />
the xml output that i got was like
<R007>
<response>
<head>
<itemCount>8</itemCount>
<todayDate>2009-02-05T15:50:12.000+01:00</todayDate>
<creditorBGNumber>01829209</creditorBGNumber>
<creditorName>ANDROMEDA</creditorName>
</head>
<list>
<listItem>
<transactionDate>2008-09-03T00:00:00.000+02:00</transactionDate>
<netSum>-6647999</netSum>
<transactions>
<transaction>
<transactionType>AGCREDIT_TRANSFER</transactionType>
<serialNumber>5</serialNumber>
<amount>-1687200</amount>
</transaction>
</transactions>
</listItem>
</list>
</response>
</R007>
But the output that i want is something like this
<R007>
<response>
<head>
<itemCount>8</itemCount>
<todayDate>2009-02-05T15:50:12.000+01:00</todayDate>
<creditorBGNumber>01829209</creditorBGNumber>
<creditorName>ANDROMEDA</creditorName>
</head>
<list>
<listItem>
<transactionDate>2008-09-03T00:00:00.000+02:00</transactionDate>
<transactions>
<transaction>
<transactionType>AGCREDIT_TRANSFER</transactionType>
<serialNumber>5</serialNumber>
<amount>-1687200</amount>
</transaction>
</transactions>
<netSum>-6647999</netSum>
</listItem>
</list>
</response>
</R007>
Hence I used the BIP built in template function like this
<element name="netSum" value="transaction.SIGN_AMOUNT" function="SUM()"/>
but the sum() function is adding up all amounts as expexted,I want
the above newsum value as
Sum(AGdebit-AGCREDIT-AG_refund).
Maybe you are looking for
-
Firefox won't load parts of web pages or let me log into certain websites
I don't quite know how to really explain this, so I'll provide two examples of the problems I'm experiencing: The first is that, whenever I go onto any of those Wikia sites, Firefox doesn't seem to load anything other than the main page content. By t
-
I need help with learning to use some of the features of my Mac. It's too late to get an Apple One to One membership as I have had the computer for a couple of years. Would think there would be experienced individuals in my area that could provide
-
OK when i import a picture onto flash stage there is a white background that outlines my pic, how can i get rid of this white background?
-
Expense Report Stuck Pending Manager Approval
1. This expense is not listed so it can be withdrawn. 2. The manager did not respond to approve the expense report and it timed out. 3. Expense is still active. (AP Standard Expense Report Process) 4. Expense report #-1 (AME Request Approval Process)
-
Problem on creating development componet
Hello all, I am currently trying scenario 2+. I have created a product, a component, a domain and a track. When I try to create a development component in netweaver studio, I keep getting: Syntax of'example.org/tax/calc' is not valid: Invalid Name; o