Formula column right or wrong
hi frds
i just want to know whether this formula colum in report builder is right or wrong
function CF_1Formula return Number is
X NUMBER;
begin
SELECT sum(ABS(nvl(TRAN.QUANTITY,0))) INTO X
FROM RCV_TRANSACTIONS TRAN,RCV_SHIPMENT_HEADERS RCV,PO_LINES_ALL PL
WHERE TRAN.TRANSACTION_TYPE ='RECEIVE' AND TRAN.PO_HEADER_ID = :PO_HEADER_ID
AND TRAN.SHIPMENT_HEADER_ID = :SHIPMENT_HEADER_ID
AND TRAN.SHIPMENT_HEADER_ID = RCV.SHIPMENT_HEADER_ID
AND RCV.RECEIPT_NUM=:RECEIPT_NUM
AND TRAN.ORGANIZATION_ID=:organization_id
AND TRAN.PO_LINE_ID = PL.PO_LINE_ID
and pl.item_id=:inventory_item_id;
RETURN(X);
end;
right
Similar Messages
-
Wat is wrong in this formula column pls help me..
wat is wrong in this formula column pls help me..
function CF_BEGIN_BALFormula return Number is
cr number;
dr number;
begin
select begin_balance_cr,begin_balance_dr into cr,dr from gl_balances
where gl_balances.period_name=:from_period
and gl_balances.code_combination_id= :ccid;
if ( abs(CR) > abs (DR) ) then
return nvl((CR - DR ) , 0) ;
else return nvl((DR - CR ) , 0) ;
end if;
end;Without any error message, it's guess work, but one thing - where do you expect those bind variables will come from?
FUNCTION cf_begin_balformula
RETURN NUMBER
IS
cr NUMBER;
dr NUMBER;
BEGIN
SELECT begin_balance_cr, begin_balance_dr
INTO cr, dr
FROM gl_balances
WHERE gl_balances.period_name = :from_period
AND gl_balances.code_combination_id = :ccid;
IF (ABS (cr) > ABS (dr)) THEN
RETURN NVL ((cr - dr), 0);
ELSE
RETURN NVL ((dr - cr), 0);
END IF;
END cf_begin_balformula; -
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 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 -
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 -
Hi,everyone:
I am trying to create a formular column, which will be a sum of two columns from two different queries.
In the data model, I could not put this CF_1 in neither of the two queries, so I put it outside the two queries, which is supposed to report level formula column.
When I ran the report, the error message is:
REP -1517. Column 'CF_1' references column 'Sales1' which has imcompatible frequency.
I don't where I should put CF_1 in the data model.
Thanks.
nullAll right Les,
Create a summary column CS_1 outside the queries.
Function: SUM
Source: Your 1st querys column (ex:
Reset At: Report
Likewise create another summary column CS_2 outside the queries.
Function: SUM
Source: Your 2nd querys column
Reset At: Report
Now create a formula column CF_1 which returns :CS_1 + :CS_2;
Create a layout field and have the source as :CF_1 and run the report.
Look this works for me with a simple example on EMP table. If you are not sure on where to place the layout field, then run a default layout (dont select :CS_1 and :CS_2 for display).
HOPE this works, otherwise send your email id- Ill send an example
null -
Why is the formula column returning garbage?
I've set up a query that performs a full outer join on two tables, returning one field from each table. Each of these fields is created by concatenating several other fields from that table, i.e.
Select a.field1 || a.field2 fielda, b.field3 || b.field4 fieldb from tablea full outer join tableb
on a.field5 = b.field5
where (a.field5 = :value or b.field5 = :value)
For any :value one or more records exists in either tablea, tableb, or neither-but never in both. This works fine in SQL*Plus, returning values in fielda, fieldb, or neither-but never in both, just as it should.
I then set up a formula column in the Group for the query, returning either fielda, fieldb, or an empty string depending on :value, i.e. If :value = 'A' then return (:fielda); ElsIf :value = 'B'; then return (:fieldb); Else return (''); End If;
In the layout I set up a repeating frame sourced to the Group, and in the frame I put a field sourced to the formula column. But the field is displaying garbage. Any ideas why?
Thanks.
Edited by: user6931915 on Dec 6, 2010 1:36 PM
OK, it's not returning garbage-it's just not returning the right data. It was appearing as garbage because the field was only large enough for 2 characters & I'd mistakenly left it set to Fixed.Since I'm so new to OS X Server - I have made many mistakes with it in my home learning environment - and therefore learned quickly to make image backups every step of the way - so restoring to v2.1 was very quick and simple.
I also wanted to point out - this problem is not limited to the main screen of the Wiki. If you disable the Wiki - but leave the default website enabled - the default website will display - but if you click on the change password link - it should pop up an enter user id, old password new password window and should also automatically switch to a trusted ssl connection - assuming you have a trusted certificate correctly configured. This functionality works fine in Safari, Firefox and Chrome - but the same behavior occurs on the password change screen in IE9 as it does in the Wiki.
I am now looking into submitting this to bugreport.apple.com. I will report back after I do that.
~Scott -
In formula column - I am getting current year - but get numeric value error
Hello
I defined a formula column as folllows:
function CF_1Formula return char is
thisyear char;
begin
select to_char(sysdate,'YYYY')
into thisyear
from dual;
return thisyear;
end;
I get - Fatal Pl/Sql error. numeric or value error. What am I doing wrong here?Or replace the whole thing with
RETURN to_char(sysdate,'YYYY');
saving a pointless round trip to the database. -
Prob with formula column plz help!!!!!
hi
iam working on a finance report
where there is a need for opening balance and closing balance colum, i have designed the column the out put comes but the prob is after displaying the opening balance closing balance it again displays a nil opening balance and closing balance for all the values given as input
its liek this
opening balance=0.00
closing balance=0.00
i have attached the formula which i have written pls help me wats wrong in the formula column
for opening balance
function CF_total_dr1Formula return Number is
begin
IF :cf_total_dr - :cf_total_cr > 0 THEN
RETURN(:cf_total_dr - :cf_total_cr);
ELSE
RETURN( 0 );
END IF;
end;
similarly for closing balance toocf_total_dr is again calculated using a formula.. similarly cf_total_dr
i have specified the formula below, again this debit balance is a formula column
function CF_total_drFormula return Number is
v_bal NUMBER;
BEGIN
v_bal := debit_balance(:p_from_date);
RETURN(v_bal);
END; -
Hi,
I have a doubt in Column formula. I have a grid with a prompt selection so that users can select a list of members which will be displayed as the columns. The grid also have a total column(formula column) at the end.
For example, If the user selects three members then the grid will show the selected members and the total column. The total column should be sum of three members similarly when I select 5 members the total should be the sum of 5 members.
Is there a way to achieve this when the number of columns will be dynamic based on the user's selection?
Thanks in advance.Just choose the sum of particular column e.g. if in Column A you are selecting RTP as 5 members then at the run time it would be 5 columns , but for the summation purpose it is a single column so choose SUM([A]).
If I am not wrong it will solve your problem as I have used it long time back.
Please let me know if doesnt solve your problem.
Thanks
YSP -
How I can Fixed Length of Formula Column
Dear All
I have create a formula column in ORACLE REPORT 6i
it consist on 15 length but problem is that formula column return output in this form
123354,000,00
But I want my formula Column return output just like this
123354,000,00
Column values fixed in line Length
Regard
Muhammad NasirHi
I think you are trying to get a proper format of your output on your report.
I will try to help you based on this assumption.
1) Select the field from paper layout
2) Select Format -> Justify -> Right from the menue. -
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
Maybe you are looking for
-
Generate SDK Documentation Using ASDoc
I am trying to obtain a copy of the toplevel_classes.xml for the entire flex framework. I need the xml file as I suffer from RSI (violins out!) and I use the xml file to generate Voice Commands to help me dictate the code. I found an excellent articl
-
Newbie: Admin account issues
I just installed a fresh copy of Leopard Server. After the install, I was faced with the "Administrator" account that I created during installation, and a "Local Administrator" account that I did not create. What is the functional difference between
-
After recent updates neither of my mac computers will play certain videos
I have a mac pro running 10.6.8 and a mac book pro running 10.7.5 and recently I downloaded security upgrades from apple. Now neither of these computers will play videos from the Canadian Business program BNN. I checked that flash was up to date and
-
How many non-leading ledgera we can assign to the one leading leder?
hi, how many non-leading ledgers we can assign for one leading ledger..?
-
New set up of Tiger - airport error
I am trying to go through the initial set up of Tiger on a Macbook and I chose our wireless network (from all those available) and then am asked for the WEP key which I supply and I get an Airport utility error and cannot proceed.