Formula column in BI
Hi all and Raineer
i have written a formula column in the below Data template and it is not giving any result for the id element when i view the xml output
<dataTemplate name="data_template" description="Template_description" dataSourceRef="TFUAT">
<parameters>
<parameter name="org_id" dataType="number" defaultValue="121"/>
</parameters>
<dataQuery>
<sqlStatement name="Q1">
<![CDATA[SELECT party_name FROM
apps.hz_parties where rownum<10
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_temp" source="Q1">
<element name="ite_use_id" value="party_name"/>
<element name="id" dataType="character" value="FormulaProfitMargin"/>
</group>
</dataStructure>
<programUnits>
<function name="FormulaProfitMargin">
<![CDATA[
FUNCTION FormulaProfitMargin RETURN number IS
BEGIN
return (10);
END;
]]>
</function>
</programUnits>
</dataTemplate>
thank you
Boo
If I use the suggested way in SQL query, I will have performace issue. My query selects 20 columns 4 among them are with aggregate functions. It is forcing me to do the group by with remaining 16 columns.
Please provide me the sample code which has alternate way to extract formula.
Thanks in advance.
Regards
Boopathi
Similar Messages
-
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). -
How to use a Formula Column in the main query?
Hi All,
I've tried to use a formula columns defined in some query in the condition of that query like this:
where (:cf_ex - :cf_ex2) >= 5
but when I run the report no data returned! Why? and how to use it the condition of the query?
Note: I'm using Forms 6iwhere (:cf_ex - :cf_ex2) >= 5You cannot do that. Formula columns are not part of the select statement (which runs in the database), but are processed in the report.
When you created this query, my guess is that you got the message "Note: the query Q1 has created the bind parameter(s) cf_ex, cf_ex2". Check these User Parameters in your data model. So, you are actually referencing user parameters in the query, not formula columns.
I made a computations and things using PL/SQL that can't be done in the select statement in the data model!If it's pl/sql you can probably use that in your query. Create some database functions for cf_ex and cf_ex2 and use these in your query. -
URL defined in formula column not converting as proper HTML tags
We are migrating a report to 10Gr2 (10.1.2.0.2) from reports 9i (9.0.2.03); This report has to route to a different web page. For this we have a formula column with meta tag call to refresh;its Contains HTM property set to Yes. But when run, the view source of HTML shows as if the tag is truncated and put in <tt> tag around it.
Any help on this is very much appreciated.Hi svee,
Thanks for the reply.
For an example i tried with the bold option in the edit formula inorder to portray the html tags problem while exporting it to the pdf inspite of using the default bold option within the column properites like u said.
Suppose if i used html tags like
<br>, </br>
in the edit formula section or if i used any other html tags which is not present as a default option in bi like bold. At that time while exporting the report to pdf i can face the issue.
And also i need ur suggestion regarding with the values disappearing for the numeric column if a tooltip is used in it while exporting it to the pdf.
Regards,
Saro
Maybe you are looking for
-
When I connect my iPod, I get this error...
I recieved a black 5G 30 GB iPod for Christmas. Here is the error I wrote down most of it. My whole screen comes up with a blue background and this is the text. I can only shut off the computer by pressing the power button. There's no other way to ge
-
"unable to read or write to disk.."?
when i connect my ipod to my computer to put songs onto it, it acts like it is working and then a window pops up that says something about not being able to read or write to the disk. i've upgraded the software and reset my ipod, but still nothing..
-
How to find out which page contains a specific ITextFrame
Hi all,<br /><br />I would like to ask if it is possible to find out which page contains a specific text frame?<br /><br />I used the following code to find the ITextFrame that contains the caret<br />ISelectionManager* mgr = activeContext->GetContex
-
Hello! Has anyone tried to created a number of production orders with LSMW? If so, can you just reccomend any particular method... because I've found none. Writing own procedure isn't very useful... P.S. Using 4.7 system. Yours respectfully, Anton.
-
Hello While doing STO between depot to depot for the same company am getting this error. I did this ME21N- VL10B-Vl02N-VF01- then if I go with J1IIN to get excise invoice then system comes with this error message. "Document is of plant 1871 which i