Handling Null element in Data Template
Hi experts ,
I am facing an issue, include_null_Element is not working properly. Find the sample code below and please help me out with your suggestion. Since my data template file is big i pasting less amount
Data template file:-
<?xml version="1.0" encoding="UTF-8" ?>
<dataTemplate name="sample" defaultPackage="sample" version="1.0">
<properties>
<property name="xml_tag_case" value="lower " />
<property name="scalable_mode" value="off" />
<property name="debug_mode" value="on" />
<property name="db_fetch_size" value="20" />
<property name="include_parameters" value="true"/>
<property name="include_null_Element" value="TRUE"/>
<property name="include_rowsettag" value="true"/>
</properties>
<dataStructure>
<*group name="G_c_fnd_precision" dataType="varchar2" source="Q_currency_precision">*
*<element name="c_fnd_precision" dataType="number" value="C_FND_PRECISION"/>*
*<element name="c_fnd_currency_code" dataType="varchar2" value="C_FND_CURRENCY_CODE"/>*
*<group name="G_one_requestor_name" dataType="varchar2" source="Q_one_requestor">*
*<element name="one_requestor_name" dataType="varchar2" value="ONE_REQUESTOR_NAME"/>*
*</group>*
*<group name="G_cancel_release_date" dataType="varchar2" source="Q_cancel_release">*
*<element name="cancel_release_date" dataType="date" value="CANCEL_RELEASE_DATE"/>*
</group>
</group>
</dataStructure>
</dataTemplate>
output (GETTING):-
<LIST_G_C_FND_PRECISION>
<G_C_FND_PRECISION>
<C_FND_PRECISION>2</C_FND_PRECISION>
<C_FND_CURRENCY_CODE>USD</C_FND_CURRENCY_CODE>
<LIST_G_ONE_REQUESTOR_NAME>
<G_ONE_REQUESTOR_NAME>
<ONE_REQUESTOR_NAME>Green, Mr. Terry</ONE_REQUESTOR_NAME>
</G_ONE_REQUESTOR_NAME>
</LIST_G_ONE_REQUESTOR_NAME>
</G_C_FND_PRECISION>
</LIST_G_C_FND_PRECISION>
OUTPUT (TO BE GET) :-
<LIST_G_C_FND_PRECISION>
<G_C_FND_PRECISION>
<C_FND_PRECISION>2</C_FND_PRECISION>
<C_FND_CURRENCY_CODE>USD</C_FND_CURRENCY_CODE>
<LIST_G_ONE_REQUESTOR_NAME>
<G_ONE_REQUESTOR_NAME>
<ONE_REQUESTOR_NAME>Green, Mr. Terry</ONE_REQUESTOR_NAME>
</G_ONE_REQUESTOR_NAME>
</LIST_G_ONE_REQUESTOR_NAME>
<LIST_G_CANCEL_RELEASE_DATE>
</LIST_G_CANCEL_RELEASE_DATE>
</G_C_FND_PRECISION>
</LIST_G_C_FND_PRECISION>
Need ur suggestion where i am making mistake. Thanks in Advance
--Santhosh
Hi Raj,
Already i tried by changing case for all property which i defined, but not making any sense.. :(
Thanks in advance
--Santhosh
Similar Messages
-
Cross tab report: handle null elements
hi
i have a cross tab report if there are null elements in the column(vertical group) the excel sheet format is not right. also if the some horizontal column elements have 1 column and some other have max 24 columns. how to handle this. please help
COL1 COL2 ...........COL24 ARE dynamic. For row 100 there 24 rows and for row 200 there will be one row. when i group by col it is also gouping the null colum into a separate column so i get extra col25 which is basically null
h1 h2 h3 h4 col1 col2 col3 col4 col4 ..............col24
100 1 2 3 10 20 30 40 50 ...............240
200 1 2 3 ...............
300 1 2 3 ...............
400 1 2 3 10 20 30 40 50 ...............240
500 1 2 3 10 20 30 40 50 ...............240
600 1 2 3 ............... pleas help.Thankssend me the template and xml data to [email protected]
-
How OSB handling null element?
hi Guys,
I having question about how to handling a null node during trasnfortation and mapping using oracle workshop for OSB 10g.
Well i have a consumer that not sending the element into the proxy, so during the proxy i will need to transform it into null element to the provider. what's in my mind is transform the element tag into something like this
{ if (fn:nilled($getAssetAttribReqParam1/RequestHdr/ns1:RequestId)) then
<ns1:RequestId xsi:null = "true"/>
else
(<ns1:RequestId>{ data($getAssetAttribReqParam1/RequestHdr/ns1:RequestId) }</ns1:RequestId>)
but when i doing testing it still showing this
<ns1:RequestId></ns1:RequestId>
i will need to sent the element something like this to the provider. because if this element is date format it will fail in the validation if i sending *<ns1:RequestId></ns1:RequestId>*
<ns1:RequestId xsi:null = "true"/>I think your case should be addressed like -
if ($getAssetAttribReqParam1/RequestHdr/ns1:RequestId) then
<ns1:RequestId>{ fn:data($getAssetAttribReqParam1/RequestHdr/ns1:RequestId) }</ns1:RequestId>
else
<ns1:RequestId/>
Regards,
Anuj -
Sum of Elements in Data Template
Dear Members,
I am developing a report using Oracle BI Publisher 10.1.3.
We are on E-Business Suite R12. I am using Data Template to Generate xml.
Following is my element structure in Data Template:
<dataTrigger name="afterParameterFormTrigger" source="XX_TEST_PKG.afterpform" />
<dataStructure>
<element name="P_REQUEST_ID" dataType="number" value="XX_TEST_PKG.P_REQUEST_ID" />
<group name="G_PRODUCT" source="Q_MAIN">
<element name="PROD_ITEM" dataType="varchar2" value="prod_item" />
<element name="PROD_DESCR" dataType="varchar2" value="prod_descr" />
<element name="PROD_ORGANIZATION_ID" dataType="number" value="prod_organization_id" />
<element name="PROD_ITEM_TYPE" dataType="varchar2" value="prod_item_type" />
<element name="prod_resources" dataType="number" value="prod_resources" />
<element name="CS_TOTAL_EXT_COST" function="sum" dataType="number" value="G_ING.EXT_COST" />
<element name="PERIOD_CODE" dataType="varchar2" value="period_code" />
<group name="G_ING" source="Q_MAIN">
<element name="LINE_NO" dataType="number" value="LINE_NO" />
<element name="LINE_TYPE" dataType="number" value="LINE_TYPE" />
<element name="ING_ITEM" dataType="varchar2" value="ING_ITEM" />
<element name="ING_ITEM_ID" dataType="number" value="ING_ITEM_ID" />
<element name="ING_DESCR" dataType="varchar2" value="ING_DESCR" />
<element name="ING_ORGANIZATION_ID" dataType="number" value="ING_ORGANIZATION_ID" />
<element name="QTY" dataType="number" value="QTY" />
<element name="ING_COST" dataType="number" value="ING_COST" />
<element name="EXT_COST" dataType="number" value="EXT_COST" />
</group>
</group>
</dataStructure>I want to sum elements by name CS_TOTAL_EXT_COST and prod_resources and put that value under G_PRODUCT.
I tried the following but it did not work:
<element name="SUM_TEST" dataType="number" value="XX_TEST_PKG.SUM_TESTING(:CS_TOTAL_EXT_COST,:prod_resources)" /> XX_TEST_PKG.SUM_TESTING is a function which sums the input parameters.
In report Builder this was very easy. I would have created a formula column and summed up what ever elements i want. I am not sure how do we do this in Data Template?
Thanks
SandeepAny Ideas on how to Achieve the Sum of a Summary Column(CS_TOTAL_EXT_COST) and a Column(prod_resources) using data template?
As i mentioned before in reports builder, this can be achieved by creating a formula column and summing both columns.
I am not able to understand how do we do this in Data Template?
I can also sum those elements in MSWord Rtf Template, but are there any other options.
Thanks
Sandeep -
How to handle null values in RTF templates
Hi - I have two groups in a report for different SQL and two formulas for each group, CF_ELE_CNT and CF_ELE_CNT1. In the template I use the below code to print or not print a section.
<?if:number(CF_ELE_CNT +CF_ELE_CNT1) >0?>
The problem is when there is no data in the second group its not creating the XML tag for CF_ELE_CNT1, though CF_ELE_CNT has 13, it still does not print that partucular section. If I remove CF_ELE_CNT1 from the condition it works fine. I was wondering how to handle this.
Any help would be appreciated!!
Thanks,
RavHey Rav,
You can add a check to identify it the element/tag is present or not
<?if:(CF_ELE_CNT1)?> will give true, if the element is present otherwise falsesince you are adding the two elements, you have to add a or condition.
<?if:(CF_ELE_CNT and number(CF_ELE_CNT) >0 ) or ( CF_ELE_CNT1 and CF_ELE_CNT1 >0)?> -
How to handle errors in data templates
Hi
What is the recommended way to handle errors for example if one of your SQL statement in a data template returned no data how and where would you be able to create an error message for the user to find and read.
Thanks,
MarkThe closest I have come to doing this is to put conditional statements into the format template. If a value matches an expected (ex. is null) you can return a message (in the report) via the format template (ex. "No Data Found").
I am not sure this really answers your question as this is in the format template, but I generally view them as a matched pair that work together. I try to stick with data extraction in the data define, and do all my conditional stuff in the format templates.
Scott -
Does BI Data Template allows calling of a package insite group element
Hi
Is it possible to call a package inside the group element tag.
When i try to call a package outside the group element it works out, but when I try to call it inside the group element it doesnt return any result.
Am currently using BI Publisher version of 5.6.3 in Oracle Applications 12.1.3
Regards
AnoopThanks for your detailed answer!!
I am trying to call a package just to understand how it works .This package just inserts a row in "suppliers" table.I ma calling this package through 'beforeReprot' trigger and querying the table after that.
I have written a package "test_pack" :
create or replace
package test_pack as
function test_insert_fun return boolean;
end test_pack;
create or replace
package body test_pack as
function test_insert_fun return boolean is
begin
insert into suppliers values (1,'p1','p2');
return (TRUE);
end;
end test_pack;
Data Template :
<dataTemplate name="test" dataSourceRef="demo" defaultpackage="test_pack">
<dataQuery>
<sqlStatement name="Q1">
<![CDATA[SELECT * from suppliers]]>
</sqlStatement>
</dataQuery>
<dataTrigger name="beforeReport" source="test_pack.test_insert_fun()"/>
</dataTemplate>
However after this , when I try to view data , I amnot seeing any output.When i go nad check the suppliers table in db, i dont see any values.
I believe this package should be executed everytime i view the data.
Please advice!! -
How to call oracle Function which has If else condition in Data Template
Hi,
currently I am working on creating Data Template which uses a Oracle Function which I need to make use in my data template. But I have some confusions on using the same. Could anybody please help me in this regard.
I have a function like this,
function invoice_query (p_facility_id facility.facility_id%TYPE,
p_wave_nbr pick_directive.wave_nbr%TYPE,
p_container_id unit_pick_group_detail.container_id%TYPE,
p_distro_nbr unit_pick_group_detail.distro_nbr%TYPE) return invoice_refcur IS
refcur invoice_refcur;
begin
IF p_wave_nbr IS NOT NULL THEN
OPEN refcur FOR SELECT t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
SYSDATE,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
min(t2.pick_order),
NULL,
t2.wave_nbr
FROM stock_order t1,
pick_directive t2,
unit_pick_group_detail t3
WHERE t1.facility_id = t2.facility_id
AND t1.facility_id = t3.facility_id
AND t2.facility_id = t3.facility_id
AND t1.distro_nbr = t2.distro_nbr
AND t1.distro_nbr = t3.distro_nbr
AND t2.distro_nbr = t3.distro_nbr
AND t1.facility_id = p_facility_id
AND t2.wave_nbr = p_wave_nbr
AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
AND t2.pick_type = 'U'
AND t3.group_id in (SELECT t4.group_id
FROM unit_pick_group t4
WHERE t4.facility_id = p_facility_id
AND t4.wave_nbr = p_wave_nbr)
GROUP BY t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
t2.wave_nbr
ORDER BY MIN(t3.group_id), MAX(t3.slot);
elsif p_container_id is not null then
OPEN refcur FOR SELECT distinct t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
SYSDATE,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
NULL,
t2.dest_id,
null
FROM stock_order t1,
unit_pick_group_detail t2
WHERE t1.facility_id = t2.facility_id
and t1.distro_nbr = t2.distro_nbr
and t1.facility_id = p_facility_id
AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
AND t2.container_id = p_container_id;
else
open refcur for SELECT distinct t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
SYSDATE,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
NULL,
NULL,
t3.wave_nbr
FROM stock_order t1,
unit_pick_group_detail t2,
unit_pick_group t3
WHERE t1.facility_id = t2.facility_id
and t2.facility_id = t3.facility_id
and t1.distro_nbr = t2.distro_nbr
and t2.group_id = t3.group_id
and t1.facility_id = p_facility_id
AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
AND t2.distro_nbr = p_distro_nbr;
END IF;
return refcur;
end;
I have created data template like following,
<sqlStatement name="Q_INVOICE">
<![CDATA[
SELECT Pack_Slip_R.invoice_query(:P_FACILITY_ID,:P_WAVE_NBR,:P_CONTAINER_ID,:P_DISTRO_NBR) from dual
]]>
</sqlStatement>
But how does I create a element for the "t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip" column in the oracle function. I normally create an element like following,
<group name="G_INVOICE" source="Q_INVOICE">
<element name="CUST_ORDER_NBR" value="cust_order_nbr"/>
<element name=":dest_id" value="dest_id"/>
</Group>
But how do i create element if a column name is kind of dynamic. Please help. I cannot Rename/change the Column in SQL Query. Please let me know If I could handle this whole logic in BI Publsiher.
Regards,
Ashoka BLtry useing alias
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip as <COLUMN_ALIAS> -
Data template - no xml data?
Hello,
I have a data template that does not seem to want to display my data. I am at a loss as to why… The select works and returns the data correctly.
Data I get when I run the select is from SQL Developer:
01-JAN-08 Hourly 1155 31 0
01-JAN-08 Salary 269 1 0
01-FEB-08 Hourly 1196 56 2
01-FEB-08 Salary 271 0 2
01-MAR-08 Hourly 1396 45 0
01-MAR-08 Salary 316 6 0
My data template is here:
<dataTemplate name="AZZ_HR_TURNOVER">
<!-- Confidential and Copyright AZZ Inc. -->
<properties>
<property name="xml_tag_case" value="upper"/>
</properties>
<parameters>
<parameter name="P_START_DATE" dataType="date"/>
<parameter name="P_END_DATE" dataType="date"/>
</parameters>
<dataQuery>
<sqlStatement name="Q_AZZ_HR_TURNOVER">
<![CDATA[
SELECT TURNOVER_MONTH AZZ_TURNOVER_MONTH,
decode(pay_basis, 'CAN Hourly', 'Hourly', 'CAN Salary', 'Salary', pay_basis) AZZ_PAY_BASIS,
COUNT(
CASE
WHEN pps_date_start <= trunc(TURNOVER_MONTH,'MM')
AND pps_actual_termination_date IS NULL OR pps_actual_termination_date >= trunc(TURNOVER_MONTH,'MM')
THEN 1 --active during period
END) EE_ACTIVE,
COUNT(
CASE
WHEN pps_actual_termination_date IS NOT NULL
AND pps_actual_termination_date BETWEEN trunc(TURNOVER_MONTH,'MM') AND last_day(TURNOVER_MONTH)
THEN 'T' --term during period
END) EE_TERM,
COUNT(
CASE
WHEN pps_date_start BETWEEN trunc(TURNOVER_MONTH,'MM') AND last_day(TURNOVER_MONTH)
THEN 'N' --new hire
END) EE_NEWHIRE
FROM (
SELECT ppb.name pay_basis,
pps.date_start pps_date_start,
pps.actual_termination_date pps_actual_termination_date,
TURNOVER_MONTH
FROM per_all_people_f ppf,
per_periods_of_service pps,
per_all_assignments_f asg,
hr_soft_coding_keyflex hsck,
hr_all_organization_units hou_gre,
hr_all_organization_units hou,
per_person_type_usages_f pptu,
per_person_types ppt,
per_pay_bases ppb,
hr_lookups hrl_l,
(SELECT DISTINCT(TRUNC(to_date(substr(:p_start_date,1,10),'YYYY-MM-DD') + rownum -1, 'MM')) turnover_month
FROM all_objects
WHERE rownum <= to_date(substr(:p_end_date,1,10),'YYYY-MM-DD') - to_date(substr(:p_start_date,1,10),'YYYY-MM-DD') + 1)
WHERE ppf.person_id = pps.person_id
AND ppf.person_id = asg.person_id
AND asg.pay_basis_id = ppb.pay_basis_id
AND pps.period_of_service_id = asg.period_of_service_id
AND asg.soft_coding_keyflex_id = hsck.soft_coding_keyflex_id
AND hsck.segment1 = hou_gre.organization_id
AND hsck.enabled_flag = 'Y'
AND asg.primary_flag = 'Y'
AND asg.assignment_type = 'E'
AND asg.organization_id = hou.organization_id
AND ppf.person_id = pptu.person_id
AND pptu.person_type_id = ppt.person_type_id
AND user_person_type IN ('Employee','Ex-employee')
AND hrl_l.lookup_type(+) = 'LEAV_REAS'
AND hrl_l.lookup_code(+) = pps.leaving_reason
AND date_start = (SELECT MAX(date_start)
FROM per_periods_of_service pps1
WHERE pps1.period_of_service_id = pps.period_of_service_id
AND date_start <= last_day(TURNOVER_MONTH) )
AND ppf.effective_start_date = (SELECT MAX(effective_start_date)
FROM per_all_people_f ppf1
WHERE ppf1.person_id = ppf.person_id
AND effective_start_date <= last_day(TURNOVER_MONTH) )
AND asg.effective_start_date = (SELECT MAX(effective_start_date)
FROM per_all_assignments_f asg1
WHERE asg1.person_id = asg.person_id
AND effective_start_date <= last_day(TURNOVER_MONTH) )
AND pptu.effective_start_date = (SELECT MAX(effective_start_date)
FROM per_person_type_usages_f pptu1,
per_person_types ppt1
WHERE pptu1.person_id = pptu.person_id
AND pptu1.person_type_id = ppt1.person_type_id
AND ppt1.user_person_type IN ('Employee','Ex-employee')
AND effective_start_date <= last_day(TURNOVER_MONTH) )
AND last_day(TURNOVER_MONTH) BETWEEN NVL(hou.date_from,last_day(TURNOVER_MONTH)) AND NVL(hou.date_to, last_day(TURNOVER_MONTH))
AND last_day(TURNOVER_MONTH) BETWEEN NVL(hou_gre.date_from,last_day(TURNOVER_MONTH)) AND NVL(hou_gre.date_to, last_day(TURNOVER_MONTH))
AND last_day(TURNOVER_MONTH) BETWEEN NVL(hsck.start_date_active,last_day(TURNOVER_MONTH)) AND NVL(hsck.end_date_active, last_day(TURNOVER_MONTH))
AND TRUNC(pps.date_start) != TRUNC(NVL(pps.actual_termination_date, to_date('31-DEC-4712','DD-MON-YYYY')))
WHERE pps_date_start <= trunc(TURNOVER_MONTH,'MM')
AND (pps_actual_termination_date IS NULL OR pps_actual_termination_date >= trunc(TURNOVER_MONTH,'MM'))
GROUP BY TURNOVER_MONTH,
decode(pay_basis, 'CAN Hourly', 'Hourly', 'CAN Salary', 'Salary', pay_basis)
ORDER BY TURNOVER_MONTH,
decode(pay_basis, 'CAN Hourly', 'Hourly', 'CAN Salary', 'Salary', pay_basis)
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_TURNOVER_MONTH" dataType="varchar2" source="Q_AZZ_HR_TURNOVER">
<element name="AZZ_TURNOVER_MONTH" dataType="varchar2" value="AZZ_TURNOVER_MONTH"/>
<group name="G_AZZ_PAY_BASIS" dataType="varchar2" source="Q_AZZ_HR_TURNOVER">
<element name="AZZ_PAY_BASIS" dataType="varchar2" value="AZZ_PAY_BASIS"/>
<group name="G_AZZ_EE_COUNT" dataType="varchar2" source="Q_AZZ_HR_TURNOVER">
<element name="EE_ACTIVE" dataType="varchar2" value="EE_ACTIVE"/>
<element name="EE_TERM" dataType="varchar2" value="EE_TERM"/>
<element name="EE_NEWHIRE" dataType="varchar2" value="EE_NEWHIRE"/>
</group>
</group>
</group>
</dataStructure>
<dataTrigger name="afterReportTrigger" source="AZZ_HR_TURNOVER.afterreport()"/>
</dataTemplate>
And the only output I am getting are my parms and my first group:
<?xml version="1.0" encoding="UTF-8" ?>
- <AZZ_HR_TURNOVER>
<P_START_DATE>2008-01-01 00:00:00.0</P_START_DATE>
<P_END_DATE>2008-07-15 00:00:00.0</P_END_DATE>
<LIST_G_TURNOVER_MONTH />
</AZZ_HR_TURNOVER>
Any asistance is much appreciated.
ScottThanks, but I just found the problem... Never trust Oracle to handle date conversions, esp in BIP. The corrected template below -- only change was the dataType of my parms to char (!)
Scott
<dataTemplate name="AZZ_HR_TURNOVER">
<!-- Confidential and Copyright AZZ Inc. -->
<properties>
<property name="xml_tag_case" value="upper"/>
</properties>
<parameters>
<parameter name="P_START_DATE" dataType="char"/>
<parameter name="P_END_DATE" dataType="char"/>
</parameters>
<dataQuery>
<sqlStatement name="Q_AZZ_HR_TURNOVER">
<![CDATA[
SELECT substr(to_char(TURNOVER_MONTH),1,10) AZZ_TURNOVER_MONTH,
decode(pay_basis, 'CAN Hourly', 'Hourly', 'CAN Salary', 'Salary', pay_basis) AZZ_PAY_BASIS,
COUNT(
CASE
WHEN pps_date_start <= trunc(TURNOVER_MONTH,'MM')
AND pps_actual_termination_date IS NULL OR pps_actual_termination_date >= trunc(TURNOVER_MONTH,'MM')
THEN 1 --active during period
END) EE_ACTIVE,
COUNT(
CASE
WHEN pps_actual_termination_date IS NOT NULL
AND pps_actual_termination_date BETWEEN trunc(TURNOVER_MONTH,'MM') AND last_day(TURNOVER_MONTH)
THEN 'T' --term during period
END) EE_TERM,
COUNT(
CASE
WHEN pps_date_start BETWEEN trunc(TURNOVER_MONTH,'MM') AND last_day(TURNOVER_MONTH)
THEN 'N' --new hire
END) EE_NEWHIRE
FROM (
SELECT ppb.name pay_basis,
pps.date_start pps_date_start,
pps.actual_termination_date pps_actual_termination_date,
TURNOVER_MONTH
FROM per_all_people_f ppf,
per_periods_of_service pps,
per_all_assignments_f asg,
hr_soft_coding_keyflex hsck,
hr_all_organization_units hou_gre,
hr_all_organization_units hou,
per_person_type_usages_f pptu,
per_person_types ppt,
per_pay_bases ppb,
hr_lookups hrl_l,
(SELECT DISTINCT(TRUNC(to_date(substr(:p_start_date,1,10),'YYYY-MM-DD') + rownum -1, 'MM')) turnover_month
FROM all_objects
WHERE rownum <= to_date(substr(:p_end_date,1,10),'YYYY-MM-DD') - to_date(substr(:p_start_date,1,10),'YYYY-MM-DD') + 1)
WHERE ppf.person_id = pps.person_id
AND ppf.person_id = asg.person_id
AND asg.pay_basis_id = ppb.pay_basis_id
AND pps.period_of_service_id = asg.period_of_service_id
AND asg.soft_coding_keyflex_id = hsck.soft_coding_keyflex_id
AND hsck.segment1 = hou_gre.organization_id
AND hsck.enabled_flag = 'Y'
AND asg.primary_flag = 'Y'
AND asg.assignment_type = 'E'
AND asg.organization_id = hou.organization_id
AND ppf.person_id = pptu.person_id
AND pptu.person_type_id = ppt.person_type_id
AND user_person_type IN ('Employee','Ex-employee')
AND hrl_l.lookup_type(+) = 'LEAV_REAS'
AND hrl_l.lookup_code(+) = pps.leaving_reason
AND date_start = (SELECT MAX(date_start)
FROM per_periods_of_service pps1
WHERE pps1.period_of_service_id = pps.period_of_service_id
AND date_start <= last_day(TURNOVER_MONTH) )
AND ppf.effective_start_date = (SELECT MAX(effective_start_date)
FROM per_all_people_f ppf1
WHERE ppf1.person_id = ppf.person_id
AND effective_start_date <= last_day(TURNOVER_MONTH) )
AND asg.effective_start_date = (SELECT MAX(effective_start_date)
FROM per_all_assignments_f asg1
WHERE asg1.person_id = asg.person_id
AND effective_start_date <= last_day(TURNOVER_MONTH) )
AND pptu.effective_start_date = (SELECT MAX(effective_start_date)
FROM per_person_type_usages_f pptu1,
per_person_types ppt1
WHERE pptu1.person_id = pptu.person_id
AND pptu1.person_type_id = ppt1.person_type_id
AND ppt1.user_person_type IN ('Employee','Ex-employee')
AND effective_start_date <= last_day(TURNOVER_MONTH) )
AND last_day(TURNOVER_MONTH) BETWEEN NVL(hou.date_from,last_day(TURNOVER_MONTH)) AND NVL(hou.date_to, last_day(TURNOVER_MONTH))
AND last_day(TURNOVER_MONTH) BETWEEN NVL(hou_gre.date_from,last_day(TURNOVER_MONTH)) AND NVL(hou_gre.date_to, last_day(TURNOVER_MONTH))
AND last_day(TURNOVER_MONTH) BETWEEN NVL(hsck.start_date_active,last_day(TURNOVER_MONTH)) AND NVL(hsck.end_date_active, last_day(TURNOVER_MONTH))
AND TRUNC(pps.date_start) != TRUNC(NVL(pps.actual_termination_date, to_date('31-DEC-4712','DD-MON-YYYY')))
WHERE pps_date_start <= trunc(TURNOVER_MONTH,'MM')
AND (pps_actual_termination_date IS NULL OR pps_actual_termination_date >= trunc(TURNOVER_MONTH,'MM'))
GROUP BY TURNOVER_MONTH,
decode(pay_basis, 'CAN Hourly', 'Hourly', 'CAN Salary', 'Salary', pay_basis)
ORDER BY TURNOVER_MONTH,
decode(pay_basis, 'CAN Hourly', 'Hourly', 'CAN Salary', 'Salary', pay_basis)
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_TURNOVER_MONTH" dataType="varchar2" source="Q_AZZ_HR_TURNOVER">
<element name="AZZ_TURNOVER_MONTH" dataType="varchar2" value="AZZ_TURNOVER_MONTH"/>
<group name="G_AZZ_PAY_BASIS" dataType="varchar2" source="Q_AZZ_HR_TURNOVER">
<element name="AZZ_PAY_BASIS" dataType="varchar2" value="AZZ_PAY_BASIS"/>
<group name="G_AZZ_EE_COUNT" dataType="varchar2" source="Q_AZZ_HR_TURNOVER">
<element name="EE_ACTIVE" dataType="varchar2" value="EE_ACTIVE"/>
<element name="EE_TERM" dataType="varchar2" value="EE_TERM"/>
<element name="EE_NEWHIRE" dataType="varchar2" value="EE_NEWHIRE"/>
</group>
</group>
</group>
</dataStructure>
<dataTrigger name="afterReportTrigger" source="AZZ_HR_TURNOVER.afterreport()"/>
</dataTemplate> -
Issues with using Outer join in Data Template
Hi all,
this is my data in two tables .
Table Ronny1
colA colB
1 u
2 v
3 x
Table Ronny2
colC colD
1 q
2 r
This is my data template
<dataTemplate name="MGF" dataSourceRef="Source1">
<dataQuery>
<sqlStatement name="Q1" dataSourceRef="Source1">
<![CDATA[select C, D from Ronny2]]>
</sqlStatement>
<sqlStatement name="Q2" dataSourceRef="Source2">
<![CDATA[select A , B from lokesh1 where A = :C]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G1" source="Q1">
<group name="G2" source="Q2">
<element name="A" value="A"/>
<element name="B" value="B"/>
</group>
</group>
</dataStructure>
</dataTemplate>
Now this would give me result as
A B
1 u
2 v
however my requirement is this
A B
1 u
2 v
3 x
that is, i want to display all the rows of table Ronny1 and matching rows from table Ronny2. I tried modifiying my second sql as
<![CDATA[select A , B from lokesh1 where A = :C (+)]]> ( using a outer join)
but this does give me correct data and comes back with the cartesion product.
Can anyone please answer this for me that how can we use the outer join in data templaes.
Thanks
Ronnyhey vetsrini,
sorry for the confusion here,
actually i want to display all the rows from table Ronny1 and i am also pulling in the matching rows from table Ronny2 and my data structure looks as ( pulling in column D from table Ronny2)
<dataStructure>
<group name="G1" source="Q1">
<group name="G2" source="Q2">
<element name="A" value="A"/>
<element name="B" value="B"/>
<element name="D" value="D"/>
</group>
</group>
</dataStructure>
and this is what i want the output to be
A B D
1 u q
2 v r
3 x
Hence the row where A <> C the data in the D column will be null, same as in the case of outer join.
any suggestions
Thx
Ronny -
Data template multiple selection problem
Hi all,
I have a problem with the Multiple Selection on the BI Publisher using data templates. One of my parameters is called p_application, this parameter is a integer/number and its values come from a list of values.
I'm getting the error "....invalid number". I think the data template is not understanding that this parameter have multiple selection.
Can you help me?
here is my data template
<dataTemplate name="user_reg" dataSourceRef="Thomson_Live_ EDC_Environment">
<properties>
<property name="include_parameters" value="false"/>
<property name="include_null_Element" value="false"/>
<property name="include_rowsettag" value="false"/>
<property name="scalable_mode" value="on"/>
<property name="db_fetch_size" value="20"/>
<property name="scalable_mode" value="on"/>
</properties>
<parameters>
<parameter name="p_customer" dataType="string" include_in_output="false"/>
<parameter name="p_application" dataType="integer" include_in_output="false"/>
<parameter name="p_start_date" dataType="date" include_in_output="false"/>
<parameter name="p_final_date" dataType="date" include_in_output="false"/>
<parameter name="p_staff_account" dataType="string" include_in_output="false"/>
</parameters>
<dataQuery>
<sqlStatement name="Q1">
<![CDATA[
select COUNT(DISTINCT TRUNC(a.TIMESTAMP)) days_logged
,COUNT(a.USER_ID) logins
,max(a.TIMESTAMP) last_access
,a.application_id application_id
,a.user_id user_id
from user_history_log a,
idweb_user b,
idweb_customer c
where to_date(to_char(a.timestamp,'dd-mm-rrrr'),'dd-mm-rrrr') between to_date(:p_start_date,'dd-mm-rrrr') and to_date(:p_final_date,'dd-mm-rrrr')
and a.user_id = b.user_id
and b.customer_key = c.customer_key
and c.staff_account = :p_staff_account
and ('0' in (:p_customer) or b.customer_key in (:p_customer))
and (0 in (:p_application) or a.application_id in (:p_application))
group by a.application_id, a.user_id ]]>
</sqlStatement>
<sqlStatement name="Q2">
<![CDATA[
SELECT IDCU.CUSTOMER_NAME "Customer name"
,PCAP.APPLICATION_NAME "Application name"
,IDUS.FIRST_NAME "First name"
,IDUS.LAST_NAME "Last name"
,IDUS.USER_NAME "Username"
,IDUS.EMAIL_ADDRESS "Email address"
,IDUS.ROLE "Job Role"
,IDUS.AREA "Job Area"
,IDUS.DEPARTMENT "Specific Job Area"
,IDUS.CITY "City"
,IDUS.US_STATE "State"
,IDUS.COUNTRY "Country"
,SALE.TERRITORY_NAME "Territory/GAM"
,BUUN.BUSINESS_UNIT_NAME "SBU"
,to_char(IDUS.REGISTRATION_DATE,'dd-mm-yyyy') "Registration date"
,to_char(PCCA.EXPIRY_DATE,'dd-mm-yyyy') "Expiry date"
,DECODE(PCUA.DISABLED,'Y','Disabled','Enabled') "Status"
,pcua.application_id application_id
,pcua.user_id user_id
FROM PC_USER_APPLICATION PCUA
,PC_CUSTOMER_APPLICATION PCCA
,IDWEB_USER IDUS
,IDWEB_CUSTOMER IDCU
,sales_territory SALE
,business_unit BUUN
,PC_APPLICATION PCAP
WHERE BUUN.BUSINESS_UNIT_ID(+) = IDCU.SBU_ID
AND SALE.TERRITORY_ID(+) = IDCU.TERRITORY_ID
AND IDCU.CUSTOMER_KEY = IDUS.CUSTOMER_KEY
AND IDUS.USER_ID = PCUA.USER_ID
AND PCCA.CUSTOMER_KEY = IDCU.CUSTOMER_KEY
AND PCCA.APPLICATION_ID = PCAP.APPLICATION_ID
AND PCAP.APPLICATION_ID = PCUA.APPLICATION_ID
AND NVL(IDUS.DISABLED,'N') = 'N'
AND IDCU.STAFF_ACCOUNT = :p_staff_account
AND ('0' in (:p_customer) or IDCU.CUSTOMER_KEY in (:p_customer))
AND (0 in (:p_application) or pcap.application_id in (:p_application))
ORDER BY IDCU.CUSTOMER_NAME, PCAP.APPLICATION_NAME, IDUS.USER_NAME ]]>
</sqlStatement>
<sqlStatement name="Q3">
<![CDATA[
select COUNT(a.TIMESTAMP) "Number of Turnaways Kickout",
MAX(a.timestamp) "Last Turnaway Kickout",
a.application_id,
a.user_id
from tpharma_user.user_refused a,
idweb_user i
where to_date(to_char(a.timestamp,'dd-mm-rrrr'),'dd-mm-rrrr') between to_date(:p_start_date,'dd-mm-rrrr') and to_date(:p_final_date,'dd-mm-rrrr')
and (0 in (:p_application) or a.application_id in (:p_application))
and a.user_id = i.user_id
and ('0' in (:p_customer) or i.customer_key in (:p_customer))
group by a.application_id, a.user_id ]]>
</sqlStatement>
<link name="ruser3" parentQuery="Q1" parentColumn="user_id" childQuery="Q3" childColumn="user_id(+)" condition="="/>
<link name="rapp3" parentQuery="Q1" parentColumn="application_id" childQuery="Q3" childColumn="application_id(+)" condition="="/>
<link name="ruser1" parentQuery="Q1" parentColumn="user_id" childQuery="Q2" childColumn="user_id" condition="="/>
<link name="rapp1" parentQuery="Q1" parentColumn="application_id" childQuery="Q2" childColumn="application_id" condition="="/>
</dataQuery>
<dataStructure>
<group name="G_totals1" source="Q1">
<element name="days_logged" value="days_logged"/>
<element name="logins" value="logins"/>
<element name="last_access" value="last_access"/>
<element name="application_id" value="application_id"/>
<element name="user_id" value="user_id"/>
</group>
<group name="G_main" source="Q2">
<element name="Customer name" value="Customer name">
<element name="Application name" value="Application name">
<element name="First name" value="First name">
<element name="Last name" value="Last name">
<element name="Username" value="Username">
<element name="Email address" value="Email address">
<element name="Job Role" value="Job Role">
<element name="Job Area" value="Job Area">
<element name="Specific Job Area" value="Specific Job Area">
<element name="City" value="City">
<element name="State" value="State">
<element name="Country" value="Country">
<element name="Territory/GAM" value="Territory/GAM">
<element name="SBU" value="SBU">
<element name="Registration date" value="Registration date">
<element name="Expiry date" value="Expiry date">
<element name="Status" value="Status">
<element name="application_id" value="application_id"/>
<element name="user_id" value="user_id"/>
</group>
<group name="G_main" source="Q3">
<element name="Number of Turnaways Kickout" value="Number of Turnaways Kickout"/>
<element name="Last Turnaway Kickout" value="Last Turnaway Kickout"/>
<element name="application_id" value="application_id"/>
<element name="user_id" value="user_id"/>
</group>
</dataStructure>
</dataTemplate>
on the XDO file, the parameters are:
<parameters>
<parameter id="p_customer" defaultValue="8c3ff6ad5eh5c8" dataType="xsd:string">
<select label="Customer: " valueSet="lv_customer" multiple="true" all="false" allValue="lov"/>
</parameter>
<parameter id="p_application" defaultValue="1" dataType="xsd:integer">
<select label="Application: " valueSet="LV_application" multiple="true" all="false" allValue="lov"/>
</parameter>
<parameter id="p_start_date" defaultValue="{$SYSDATE()$}" dataType="xsd:date">
<date label="Usage occurs on or after (dd-mm-yyyy):" size="11" format="dd-MM-yyyy" minValue="01-06-1950" maxValue="01-06-2100"/>
</parameter>
<parameter id="p_final_date" defaultValue="{$SYSDATE()$}" dataType="xsd:date">
<date label="Usage occurs on or before (dd-mm-yyyy):" size="11" format="dd-MM-yyyy" minValue="01-06-1950" maxValue="01-06-2100"/>
</parameter>
<parameter id="p_staff_account" defaultValue="Y">
<select label="Staff Accout: " valueSet="lv_staff_account" multiple="false" all="false" allValue="null"/>
</parameter>
</parameters>
Thank you,
Marcelo Cure
Oracle Developer
[email protected]
www.ilegra.com
Edited by: user11307652 on 09/03/2010 05:21
Edited by: user11307652 on 09/03/2010 06:15I have a similar problem where i cannot use the parameter with comma separated values in the parameter.
my report definition is as below.
<dataTemplate name="COMLTRDATA" description="Data for the COMLTR letters" dataSourceRef="PRISM">
<parameters>
<parameter name="secondary_sequence" dataType="number" include_in_output="false"/>
</parameters>
<dataQuery>
<sqlStatement name="Q1">
<![CDATA[select PR_LETTER_MASTER.LETTER_ID as LETTER_ID,
to_char(PR_LETTER_MASTER.LETTER_DATE,'FMMonth DD, RRRR') as LETTER_DATE,
PR_LETTER_MASTER.LETTER_NAME as LETTER_NAME,
PR_LETTER_MASTER.ADDRESS_TYPE as ADDRESS_TYPE,
PR_LETTER_MASTER.REVIEWED_FIRM_NUMBER as REVIEWED_FIRM_NUMBER,
PR_LETTER_MASTER.REVIEWED_FIRM_NAME as REVIEWED_FIRM_NAME,
PR_LETTER_MASTER.REVIEWED_FIRM_TYPE as REVIEWED_FIRM_TYPE,
PR_LETTER_MASTER.REVIEWING_FIRM_NUMBER as REVIEWING_FIRM_NUMBER,
PR_LETTER_MASTER.REVIEW_NUMBER as REVIEW_NUMBER,
PR_LETTER_MASTER.SALUTATION as SALUTATION,
PR_LETTER_MASTER.SIGNATURE_EMAIL_ID as SIGNATURE_EMAIL_ID,
PR_LETTER_MASTER.SIGNATURE_TITLE as SIGNATURE_TITLE,
PR_LETTER_MASTER.REVIEW_STATUS as REVIEW_STATUS,
to_char(PR_LETTER_MASTER.REVIEW_COMMENCEMENT_DATE,'FMMonth DD, RRRR') as REVIEW_COMMENCEMENT_DATE,
to_char(PR_LETTER_MASTER.REVIEW_DUE_DATE,'FMMonth DD, RRRR') as REVIEW_DUE_DATE,
PR_LETTER_MASTER.REVIEW_YEAR as REVIEW_YEAR,
PR_LETTER_MASTER.REVIEW_PROGRAM as REVIEW_PROGRAM,
PR_LETTER_MASTER.REVIEW_TYPE as REVIEW_TYPE,
PR_LETTER_MASTER.TEAM_CAPT_FIRM_NAME as TEAM_CAPT_FIRM_NAME,
PR_LETTER_MASTER.PRIOR_REVIEW_NUMBER as PRIOR_REVIEW_NUMBER,
PR_LETTER_MASTER.MNGPTR_MEMBER_NUMBER as MNGPTR_MEMBER_NUMBER,
PR_LETTER_MASTER.FIRST_NAME as FIRST_NAME,
PR_LETTER_MASTER.MIDDLE_INITIAL as MIDDLE_INITIAL,
PR_LETTER_MASTER.LAST_NAME as LAST_NAME,
PR_LETTER_MASTER.ADDRESS_LINE1 as ADDRESS_LINE1,
PR_LETTER_MASTER.ADDRESS_LINE2 as ADDRESS_LINE2,
PR_LETTER_MASTER.ADDRESS_LINE3 as ADDRESS_LINE3,
PR_LETTER_MASTER.CITY as CITY,
PR_LETTER_MASTER.STATE as STATE,
PR_LETTER_MASTER.ZIP as ZIP,
PR_LETTER_MASTER.ZIP_PLUS as ZIP_PLUS,
PR_LETTER_MASTER.DELIVERY_EMAIL_ID as DELIVERY_EMAIL_ID,
PR_LETTER_MASTER.SIGNATURE_TYPE as SIGNATURE_TYPE,
PR_LETTER_MASTER.SIGNATURE_NAME as SIGNATURE_NAME,
PR_LETTER_MASTER.TEAM_CAPT_MEMBER_NUMBER as TEAM_CAPT_MEMBER_NUMBER,
PR_LETTER_MASTER.SIGNATURE_PHONE_NUMBER as SIGNATURE_PHONE_NUMBER,
PR_LETTER_MASTER.LAST_LETTER_SENT_DATE1 as LAST_LETTER_SENT_DATE1,
PR_LETTER_MASTER.LAST_LETTER_SENT_DATE2 as LAST_LETTER_SENT_DATE2,
PR_LETTER_MASTER.LAST_LETTER_SENT_DATE3 as LAST_LETTER_SENT_DATE3,
to_char(PR_LETTER_MASTER.EXIT_CONFERENCE_DATE,'FMMonth DD, RRRR') as EXIT_CONFERENCE_DATE,
PR_LETTER_MASTER.REVIEW_TAX_SEASON as REVIEW_TAX_SEASON,
PR_LETTER_MASTER.STATE_SOCIETY_NUM as STATE_SOCIETY_NUM,
PR_LETTER_MASTER.STATE_SOCIETY_NAME as STATE_SOCIETY_NAME,
PR_LETTER_MASTER.SECONDARY_LETTER_SEQUENCE as SECONDARY_LETTER_SEQUENCE,
PR_LETTER_MASTER.CREATION_DATE as CREATION_DATE,
PR_LETTER_MASTER.STATE_CODE as STATE_CODE ,
PR_LETTER_MASTER.DELIVERY_EMAIL_ID as DELIVERY_EMAIL_ID,
PR_LETTER_MASTER.TEAM_CAPT_FIRST_NAME as TEAM_CAPT_FIRST_NAME,
PR_LETTER_MASTER.TEAM_CAPT_LAST_NAME as TEAM_CAPT_LAST_NAME,
to_char(PR_LETTER_MASTER.DT_RAB_PRESENTATION,'FMMonth DD, RRRR') as DT_RAB_PRESENTATION,
PR_LETTER_MASTER.RAB_DESCRIPTION as RAB_DESCRIPTION ,
PR_LETTER_MASTER.TEAM_CAPT_MIDDLE_INITIAL as TEAM_CAPT_MIDDLE_INITIAL,
pr_letter_master.salutation as Salutation
from PRISM.PR_LETTER_MASTER PR_LETTER_MASTER
where secondary_letter_sequence in (:secondary_sequence)]]>
</sqlStatement>
<sqlStatement name="Q2">
<![CDATA[select followup_description from pr_letter_details where secondary_letter_sequence = :SECONDARY_LETTER_SEQUENCE]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="letter1" source="Q1">
<element name="LETTER_DATE" value="LETTER_DATE"/>
<element name="FIRST_NAME" value="FIRST_NAME"/>
<element name="MIDDLE_INITIAL" value="MIDDLE_INITIAL"/>
<element name="LAST_NAME" value="LAST_NAME"/>
<element name="ADDRESS_LINE1" value="ADDRESS_LINE1"/>
<element name="ADDRESS_LINE2" value="ADDRESS_LINE2"/>
<element name="ADDRESS_LINE3" value="ADDRESS_LINE3"/>
<element name="CITY" value="CITY"/>
<element name="STATE" value="STATE"/>
<element name="ZIP" value="ZIP"/>
<element name="ZIP_PLUS" value="ZIP_PLUS"/>
<element name="SALUTATION" value="SALUTATION"/>
<element name="REVIEW_TYPE" value="REVIEW_TYPE"/>
<element name="DT_RAB_PRESENTATION" value="DT_RAB_PRESENTATION"/>
<element name="RAB_DESCRIPTION" value="RAB_DESCRIPTION"/>
<element name="SIGNATURE_NAME" value="SIGNATURE_NAME"/>
<element name="SIGNATURE_PHONE_NUMBER" value="SIGNATURE_PHONE_NUMBER"/>
<element name="SIGNATURE_TITLE" value="SIGNATURE_TITLE"/>
<element name="SIGNATURE_EMAIL_ID" value="SIGNATURE_EMAIL_ID"/>
<element name="TEAM_CAPT_MIDDLE_INITIAL" value="TEAM_CAPT_MIDDLE_INITIAL"/>
<element name="TEAM_CAPT_FIRST_NAME" value="TEAM_CAPT_FIRST_NAME"/>
<element name="TEAM_CAPT_LAST_NAME" value="TEAM_CAPT_LAST_NAME"/>
<element name="REVIEWED_FIRM_NUMBER" value="REVIEWED_FIRM_NUMBER"/>
<element name="REVIEWED_FIRM_NAME" value="REVIEWED_FIRM_NAME"/>
<element name="REVIEW_NUMBER" value="REVIEW_NUMBER"/>
<element name="LETTER_ID" value="LETTER_ID"/>
<group name="Detail" source="Q2">
<element name="followup_description" value="followup_description"/>
</group>
</group>
</dataStructure>
</dataTemplate> -
Data template datatrigger error
Hi I have a data template that I'm currently getting an datatrigger error with when trying to generate the xml data. I believe I have my dataTrigger coded correctly and am unsure how to resolve this problem. Below is the data template code, plsql code and the actual error. Can somebody please tell me how to fix this error?
Please help!
<?xml version="1.0"?>
<dataTemplate name="XXKNC_WIPDJCR" description="WIP Critical Ratio Report" dataSourceRef="TEST" version="1.0">
<parameters>
<parameter name="S_DEPT" dataType="character"/>
<parameter name="E_DEPT" dataType="character"/>
<parameter name="P_QTY_IN_QUEUE" dataType="character"/>
</parameters>
<dataQuery>
<sqlStatement name="MAIN_Q1">
<![CDATA[
select distinct cr.Dept_Name, cr.Dept_Description,
case
when cr.denominator = 0 then 0
else round(cr.numerator/cr.denominator,2)
end critical_ratio,
cr.Sched_Op_Start_Date, cr.Sched_Op_Completion_Date,
to_char(cr.MPS_SCHEDULED_COMPLETION_DATE,'MM/DD/RRRR') as JOB_COMP_DATE,
cr.Job_Name, cr.Lot_Number, cr.PART# as ITEM,
substr(cr.Item_Description,1,50) as Item_Description, cr.Op_Seq as OPER,
substr(cr.OP_Description,1,30) as OP_Description, cr.Quantity_Scheduled, cr.Quantity_In_Queue, cr.QUANTITY_COMPLETED
from
select distinct a.Dept_Name, a.Dept_Description, a.Job_Name, a.wip_entity_id, a.MPS_SCHEDULED_COMPLETION_DATE, round(xxknc_critical_ratio_num(a.wip_entity_id),4) as numerator,
den.denominator, to_char(a.Sched_Op_Start_Date,'MM/DD/RRRR') as Sched_Op_Start_Date,
to_char(a.Sched_Op_Completion_Date,'MM/DD/RRRR') as Sched_Op_Completion_Date,
a.PART#, a.Item_Description, a.LOT_NUMBER, a.Quantity_Scheduled, a.Quantity_In_Queue,
a.QUANTITY_COMPLETED, a.Op_Seq, a.OP_Description,
xxknc.xxknc_qty_in_queue.CF_RowNumFormula as CF_RowNumFormula
from
select distinct BD.DEPARTMENT_CODE Dept_Name, BD.DESCRIPTION Dept_Description,
WE.WIP_ENTITY_NAME Job_Name, dj.lot_number, dj.MPS_SCHEDULED_COMPLETION_DATE,
WO.FIRST_UNIT_START_DATE as Sched_Op_Start_Date,
WO.LAST_UNIT_COMPLETION_DATE as Sched_Op_Completion_Date, i.inventory_item AS PART#,
i.DESCRIPTION Item_Description, WO.OPERATION_SEQ_NUM Op_Seq, WO.DESCRIPTION OP_Description,
WO.SCHEDULED_QUANTITY Quantity_Scheduled, WO.QUANTITY_IN_QUEUE Quantity_In_Queue,
WO.QUANTITY_COMPLETED, wor.usage_rate_or_amount, wor.applied_resource_units, wo.wip_entity_id
from apps.WIP_OPERATIONS wo, BOM_DEPARTMENTS BD, wip_operation_resources wor
,WIP_DISCRETE_JOBS DJ, WIP_ENTITIES WE, invfg_items i
where WO.ORGANIZATION_ID = 82
and DJ.ORGANIZATION_ID = 82
AND WE.ORGANIZATION_ID = 82
AND i.ORGANIZATION_ID = 82
AND BD.ORGANIZATION_ID = 82
AND BD.DEPARTMENT_ID = WO.DEPARTMENT_ID
AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
AND WE.ENTITY_TYPE = 1
and dj.status_type = 3
AND wo.wip_entity_id = dj.wip_entity_id
AND wor.wip_entity_id = wo.wip_entity_id
AND wor.operation_seq_num = wo.operation_seq_num
AND wor.uom_code IN ('HR')
and basis_type in (2)
and activity_id in (4,1000)
UNION
select distinct BD.DEPARTMENT_CODE Dept_Name, BD.DESCRIPTION Dept_Description,
WE.WIP_ENTITY_NAME Job_Name, dj.lot_number, dj.MPS_SCHEDULED_COMPLETION_DATE,
WO.FIRST_UNIT_START_DATE as Sched_Op_Start_Date,
WO.LAST_UNIT_COMPLETION_DATE as Sched_Op_Completion_Date,
i.inventory_item AS PART#, i.DESCRIPTION Item_Description, WO.OPERATION_SEQ_NUM Op_Seq,
WO.DESCRIPTION OP_Description, WO.SCHEDULED_QUANTITY Quantity_Scheduled,
WO.QUANTITY_IN_QUEUE Quantity_In_Queue, WO.QUANTITY_COMPLETED,
(wor.usage_rate_or_amount * WO.QUANTITY_COMPLETED) as usage_rate_or_amount,
wor.applied_resource_units, wo.wip_entity_id
from apps.WIP_OPERATIONS wo, BOM_DEPARTMENTS BD, wip_operation_resources wor ,WIP_DISCRETE_JOBS DJ, WIP_ENTITIES WE, invfg_items i
where WO.ORGANIZATION_ID = 82
and DJ.ORGANIZATION_ID = 82
AND WE.ORGANIZATION_ID = 82
AND i.ORGANIZATION_ID = 82
AND BD.ORGANIZATION_ID = 82
AND BD.DEPARTMENT_ID = WO.DEPARTMENT_ID
AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
AND WE.ENTITY_TYPE = 1
and dj.status_type = 3
AND wo.wip_entity_id = dj.wip_entity_id
AND wor.wip_entity_id = wo.wip_entity_id
AND wor.operation_seq_num = wo.operation_seq_num
AND wor.uom_code IN ('HR')
and basis_type in (1)
and activity_id in (1)
UNION
select distinct BD.DEPARTMENT_CODE Dept_Name, BD.DESCRIPTION Dept_Description,
WE.WIP_ENTITY_NAME Job_Name, dj.lot_number, dj.MPS_SCHEDULED_COMPLETION_DATE,
WO.FIRST_UNIT_START_DATE as Sched_Op_Start_Date,
WO.LAST_UNIT_COMPLETION_DATE as Sched_Op_Completion_Date,
i.inventory_item AS PART#, i.DESCRIPTION Item_Description, WO.OPERATION_SEQ_NUM Op_Seq,
WO.DESCRIPTION OP_Description, WO.SCHEDULED_QUANTITY Quantity_Scheduled,
WO.QUANTITY_IN_QUEUE Quantity_In_Queue, WO.QUANTITY_COMPLETED,
(wor.usage_rate_or_amount * 24) as usage_rate_or_amount,
wor.applied_resource_units, wo.wip_entity_id
from apps.WIP_OPERATIONS wo,
BOM_DEPARTMENTS BD, wip_operation_resources wor, WIP_DISCRETE_JOBS DJ, WIP_ENTITIES WE
,invfg_items i
where WO.ORGANIZATION_ID = 82
and DJ.ORGANIZATION_ID = 82
AND WE.ORGANIZATION_ID = 82
AND i.ORGANIZATION_ID = 82
AND BD.ORGANIZATION_ID = 82
AND BD.DEPARTMENT_ID = WO.DEPARTMENT_ID
AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
AND WE.ENTITY_TYPE = 1
and dj.status_type = 3
AND wo.wip_entity_id = dj.wip_entity_id
AND wor.wip_entity_id = wo.wip_entity_id
AND wor.operation_seq_num = wo.operation_seq_num
AND wor.uom_code IN ('DAY')
and basis_type in (2)
and activity_id in (4,1000)
UNION
select distinct BD.DEPARTMENT_CODE Dept_Name, BD.DESCRIPTION Dept_Description,
WE.WIP_ENTITY_NAME Job_Name, dj.lot_number, dj.MPS_SCHEDULED_COMPLETION_DATE,
WO.FIRST_UNIT_START_DATE as Sched_Op_Start_Date,
WO.LAST_UNIT_COMPLETION_DATE as Sched_Op_Completion_Date,
i.inventory_item AS PART#, i.DESCRIPTION Item_Description, WO.OPERATION_SEQ_NUM Op_Seq,
WO.DESCRIPTION OP_Description, WO.SCHEDULED_QUANTITY Quantity_Scheduled,
WO.QUANTITY_IN_QUEUE Quantity_In_Queue, WO.QUANTITY_COMPLETED,
((wor.usage_rate_or_amount * 24) * WO.QUANTITY_COMPLETED) as usage_rate_or_amount,
wor.applied_resource_units, wo.wip_entity_id
from apps.WIP_OPERATIONS wo, BOM_DEPARTMENTS BD, wip_operation_resources wor
,WIP_DISCRETE_JOBS DJ, WIP_ENTITIES WE, invfg_items i
where WO.ORGANIZATION_ID = 82
and DJ.ORGANIZATION_ID = 82
AND WE.ORGANIZATION_ID = 82
AND i.ORGANIZATION_ID = 82
AND BD.ORGANIZATION_ID = 82
AND BD.DEPARTMENT_ID = WO.DEPARTMENT_ID
AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
AND WE.ENTITY_TYPE = 1
and dj.status_type = 3
AND wo.wip_entity_id = dj.wip_entity_id
AND wor.wip_entity_id = wo.wip_entity_id
AND wor.operation_seq_num = wo.operation_seq_num
AND wor.uom_code IN ('DAY')
and basis_type in (1)
and activity_id in (1)
UNION
select distinct BD.DEPARTMENT_CODE Dept_Name, BD.DESCRIPTION Dept_Description, WE.WIP_ENTITY_NAME Job_Name, dj.lot_number, dj.MPS_SCHEDULED_COMPLETION_DATE,
WO.FIRST_UNIT_START_DATE as Sched_Op_Start_Date,
WO.LAST_UNIT_COMPLETION_DATE as Sched_Op_Completion_Date,
i.inventory_item AS PART#, i.DESCRIPTION Item_Description, WO.OPERATION_SEQ_NUM Op_Seq,
WO.DESCRIPTION OP_Description, WO.SCHEDULED_QUANTITY Quantity_Scheduled,
WO.QUANTITY_IN_QUEUE Quantity_In_Queue, WO.QUANTITY_COMPLETED,
NULL AS usage_rate_or_amount, NULL AS applied_resource_units, wo.wip_entity_id
from apps.WIP_OPERATIONS wo, BOM_DEPARTMENTS BD, WIP_DISCRETE_JOBS DJ,
WIP_ENTITIES WE, invfg_items i
where WO.ORGANIZATION_ID = 82
and DJ.ORGANIZATION_ID = 82
AND WE.ORGANIZATION_ID = 82
AND i.ORGANIZATION_ID = 82
AND BD.ORGANIZATION_ID = 82
AND BD.DEPARTMENT_ID = WO.DEPARTMENT_ID
AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
AND WE.ENTITY_TYPE = 1
and dj.status_type = 3
AND wo.wip_entity_id = dj.wip_entity_id
and wo.operation_seq_num between 1 and 10
and wo.quantity_in_queue > 0
and wo.operation_seq_num NOT IN (select distinct operation_seq_num from wip_operation_resources
where wip_entity_id = wo.wip_entity_id
and operation_seq_num between 1 and 10)
order by 1
) a,
( -- this inline view gets the denominator value
select b.Job_Name, b.WIP_ENTITY_ID, xxknc_critical_ratio_den (b.wip_entity_id) as denominator
from
select a.Job_Name, a.WIP_ENTITY_ID,
sum(a.usage_rate_or_amount) as usage_rate_or_amount
from
select distinct WE.WIP_ENTITY_ID, WE.WIP_ENTITY_NAME Job_Name, wor.usage_rate_or_amount, WO.LAST_UNIT_COMPLETION_DATE
from apps.WIP_OPERATIONS wo, wip_operation_resources wor, WIP_DISCRETE_JOBS DJ
,WIP_ENTITIES WE, invfg_items i
where WO.ORGANIZATION_ID = 82
and DJ.ORGANIZATION_ID = 82
AND WE.ORGANIZATION_ID = 82
AND i.ORGANIZATION_ID = 82
AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
AND WE.ENTITY_TYPE = 1
and dj.status_type = 3
AND wo.wip_entity_id = dj.wip_entity_id
AND wor.wip_entity_id = wo.wip_entity_id
AND wor.operation_seq_num = wo.operation_seq_num
AND wor.uom_code IN ('HR')
and basis_type in (2)
and activity_id in (4,1000)
UNION
select distinct WE.WIP_ENTITY_ID, WE.WIP_ENTITY_NAME Job_Name,
(wor.usage_rate_or_amount * WO.QUANTITY_COMPLETED) as usage_rate_or_amount, WO.LAST_UNIT_COMPLETION_DATE
from apps.WIP_OPERATIONS wo, wip_operation_resources wor, WIP_DISCRETE_JOBS DJ
,WIP_ENTITIES WE, invfg_items i
where WO.ORGANIZATION_ID = 82
and DJ.ORGANIZATION_ID = 82
AND WE.ORGANIZATION_ID = 82
AND i.ORGANIZATION_ID = 82
AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
AND WE.ENTITY_TYPE = 1
and dj.status_type = 3
AND wo.wip_entity_id = dj.wip_entity_id
AND wor.wip_entity_id = wo.wip_entity_id
AND wor.operation_seq_num = wo.operation_seq_num
AND wor.uom_code IN ('HR')
and basis_type in (1)
and activity_id in (1)
UNION
select distinct WE.WIP_ENTITY_ID, WE.WIP_ENTITY_NAME Job_Name,
(wor.usage_rate_or_amount * 24) as usage_rate_or_amount, WO.LAST_UNIT_COMPLETION_DATE
from apps.WIP_OPERATIONS wo, wip_operation_resources wor, WIP_DISCRETE_JOBS DJ
,WIP_ENTITIES WE, invfg_items i
where WO.ORGANIZATION_ID = 82
and DJ.ORGANIZATION_ID = 82
AND WE.ORGANIZATION_ID = 82
AND i.ORGANIZATION_ID = 82
AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
AND WE.ENTITY_TYPE = 1
and dj.status_type = 3
AND wo.wip_entity_id = dj.wip_entity_id
AND wor.wip_entity_id = wo.wip_entity_id
AND wor.operation_seq_num = wo.operation_seq_num
AND wor.uom_code IN ('DAY')
and basis_type in (2)
and activity_id in (4,1000)
UNION
select distinct WE.WIP_ENTITY_ID, WE.WIP_ENTITY_NAME Job_Name,
((wor.usage_rate_or_amount * 24) * WO.QUANTITY_COMPLETED) as usage_rate_or_amount, WO.LAST_UNIT_COMPLETION_DATE
from apps.WIP_OPERATIONS wo, wip_operation_resources wor, WIP_DISCRETE_JOBS DJ
,WIP_ENTITIES WE, invfg_items i
where WO.ORGANIZATION_ID = 82
and DJ.ORGANIZATION_ID = 82
AND WE.ORGANIZATION_ID = 82
AND i.ORGANIZATION_ID = 82
AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
AND WE.ENTITY_TYPE = 1
and dj.status_type = 3
AND wo.wip_entity_id = dj.wip_entity_id
AND wor.wip_entity_id = wo.wip_entity_id
AND wor.operation_seq_num = wo.operation_seq_num
AND wor.uom_code IN ('DAY')
and basis_type in (1)
and activity_id in (1)
order by 1
) a
group by a.WIP_ENTITY_ID, a.Job_Name
) b
order by 1
) den
where a.wip_entity_id = den.wip_entity_id
ORDER BY a.Job_Name
) cr
where upper(cr.Dept_Name) between nvl(upper(:S_DEPT), upper(cr.Dept_Name)) and nvl(upper(:E_DEPT),upper(cr.Dept_Name))
and &pwhereclause
order by 1,3,6,8
]]>
</sqlStatement>
</dataQuery>
<dataTrigger name="beforeReport" source="xxknc_qty_in_queue.BeforeReportTrigger(:P_QTY_IN_QUEUE)" />
<dataStructure>
<group name="G_DEPT_NAME" source="MAIN_Q1">
<element name="Dept_Name" value="DEPT_NAME" />
<element name="DEPT_DESCRIPTION" value="DEPT_DESCRIPTION" />
<element name="LOT_NUMBER" value="LOT_NUMBER" />
<element name="QUANTITY_SCHEDULED" value="QUANTITY_SCHEDULED" />
<element name="CRITICAL_RATIO" value="CRITICAL_RATIO" />
<element name="SCHED_OP_START_DATE" value="SCHED_OP_START_DATE" />
<element name="SCHED_OP_COMPLETION_DATE" value="SCHED_OP_COMPLETION_DATE" />
<element name="JOB_COMP_DATE" value="JOB_COMP_DATE" />
<element name="JOB_NAME" value="JOB_NAME" />
<element name="ITEM" value="ITEM" />
<element name="ITEM_DESCRIPTION" value="ITEM_DESCRIPTION" />
<element name="OPER" value="OPER" />
<element name="OPER_DESCRIPTION" value="OPER_DESCRIPTION" />
<element name="QUANTITY_IN_QUEUE" value="QUANTITY_IN_QUEUE" />
<element name="QUANTITY_COMPLETED" value="QUANTITY_COMPLETED" />
<element name="CF_ROWNUMFORMULA" value="CF_ROWNUMFORMULA" />
<element name="S_DEPT" value="S_DEPT" />
<element name="E_DEPT" value="E_DEPT" />
<element name="P_QTY_IN_QUEUE" value="P_QTY_IN_QUEUE" />
</group>
</dataStructure>
</dataTemplate>
create or replace package xxknc_qty_in_queue is
P_QTY_IN_QUEUE varchar2(100);
pwhereclause varchar2(1000);
function BeforeReportTrigger(p_qty_in_queue IN varchar2) return boolean;
function CF_RowNumFormula return number;
end xxknc_qty_in_queue;
create or replace package body xxknc_qty_in_queue as
function BeforeReportTrigger(p_qty_in_queue IN varchar2) return boolean
is
begin
pwhereclause := 'x';
if(upper(P_QTY_IN_QUEUE) = 'YES') then
pwhereclause := 'cr.Quantity_In_Queue > 0';
elsif (upper(P_QTY_IN_QUEUE) = 'NO') then
pwhereclause := 'cr.Quantity_In_Queue = 0';
else
pwhereclause := '1=1';
end if;
return (TRUE);
end BeforeReportTrigger;
function CF_RowNumFormula return Number
is
vCount number;
begin
vCount := 0;
vCount:=apps.XXKNC_SHIP_OUTLOOK_REPORT;
if (mod(vCount,2) = 0) then
return 1;
else
return 0;
end if;
end CF_RowNumFormula;
end xxknc_qty_in_queue;
Custom Application: Version : UNKNOWN
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
XXKNC_WIPDJCR_DEF module: XXKNC_WIP_XML_Data_Template
Current system time is 20-JUL-2009 08:24:12
XDO Data Engine Version No: 5.6.3
Resp: 20420
Org ID : 81
Request ID: 3370019
All Parameters: S_DEPT=ADMIN:E_DEPT=INSP:P_QTY_IN_QUEUE=YES:CP_QTY_IN_QUEUE=YES
Data Template Code: XXKNC_WIPDJCR_DEF
Data Template Application Short Name: CUSTOM
Debug Flag: N
{E_DEPT=INSP, S_DEPT=ADMIN, CP_QTY_IN_QUEUE=YES, P_QTY_IN_QUEUE=YES}
Calling XDO Data Engine...
[072009_082414567][][ERROR] Variable 'pwhereclause' is missing....
[072009_082414616][][EXCEPTION] java.sql.SQLException: ORA-06550: line 2, column 18:
PLS-00103: Encountered the symbol "." when expecting one of the following:
( - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string literal with character set specification>
<an alternatively-quoted S
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:590)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1973)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1119)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2191)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2064)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2989)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:736)
at oracle.apps.xdo.dataengine.DataTemplateParser.getRemoteValue(DataTemplateParser.java:1756)
at oracle.apps.xdo.dataengine.DataTemplateParser.getSubstituteObject(DataTemplateParser.java:1583)
at oracle.apps.xdo.dataengine.DataTemplateParser.replaceSubstituteVariables(DataTemplateParser.java:1404)
at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:440)
at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:429)
at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:300)
at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:266)
at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:205)
at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:237)
at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:364)
at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:236)
at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:293)
at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
--SQLException
java.sql.SQLException: ORA-00920: invalid relational operator
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:590)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1973)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:850)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2599)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2963)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:584)
at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:515)
at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:429)
at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:300)
at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:266)
at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:205)
at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:237)
at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:364)
at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:236)
at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:293)
at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
Start of log messages from FND_FILE
End of log messages from FND_FILE
Executing request completion options...
Finished executing request completion options.
Concurrent request completed
Current system time is 20-JUL-2009 08:24:14
---------------------------------------------------------------------------Misra, I noticed that I misspelled my pwhereclaus parameter so I went back and corrected it. When I executed the data template I got a new error. Can you tell me what this error means or how to fix this?
Custom Application: Version : UNKNOWN
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
XXKNC_WIPDJCR_DEF module: XXKNC_WIP_XML_Data_Template
Current system time is 20-JUL-2009 11:40:07
XDO Data Engine Version No: 5.6.3
Resp: 20420
Org ID : 81
Request ID: 3370253
All Parameters: S_DEPT=ADMIN:E_DEPT=BIO:P_QTY_IN_QUEUE=YES:CP_QTY_IN_QUEUE=YES
Data Template Code: XXKNC_WIPDJCR_DEF
Data Template Application Short Name: CUSTOM
Debug Flag: N
{E_DEPT=BIO, S_DEPT=ADMIN, CP_QTY_IN_QUEUE=YES, P_QTY_IN_QUEUE=YES}
Calling XDO Data Engine...
java.lang.NullPointerException
at oracle.apps.xdo.dataengine.DataTemplateParser.getObjectVlaue(DataTemplateParser.java:1695)
at oracle.apps.xdo.dataengine.DataTemplateParser.replaceSubstituteVariables(DataTemplateParser.java:1414)
at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:440)
at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:429)
at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:300)
at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:266)
at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:205)
at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:237)
at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:364)
at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:236)
at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:293)
at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
Start of log messages from FND_FILE
End of log messages from FND_FILE
Executing request completion options...
Finished executing request completion options.
Concurrent request completed
Current system time is 20-JUL-2009 11:40:09
--------------------------------------------------------------------------- -
How to implement place holder columns in data template
Hi,
I have a requirement where I have to mimic the functionality of place holder columns in RDF using Data Templates in XML Publisher.
How can I call a pl/sql function at element level when we try to group records in the data template.
To make it simple , let us say I have a requirement to retrieve the address of an employee(address line 1,address line 2, city,country)
In RDF what I do is define 4 place holder columns to capture address attributes, and in a formula column I set values to these attributes. How do I implement this in XML Publisher data template.
When I tried to implement the above requirement using test variables, I was able to execute a pl/sql function after the group tag, but not within the group tag.
I got the result for calc_values3 , but didn;t get anythng for calc_values1 and 2
Data Template:
<dataTemplate name="XXLCPAY142R" description="online payslip" defaultPackage="XXLCPAY_ONLINEPAYSLIP_PKG" version="1.0">
<parameters>
<parameter name="P_ASSIGNMENT_ACTION_ID" dataType="number" />
</parameters>
<dataQuery>
<sqlStatement name="Q_PAYMENT_RUN">
<![CDATA[
SELECT PAAPRV.assignment_action_id assignment_action_id
,PAAPRV.payroll_action_id payroll_action_id
,PAAPRV.run_assignment_action_id run_assignment_action_id
,PAAPRV.run_payroll_action_id run_payroll_action_id
,PAAPRV.person_id person_id
,PAAPRV.full_name full_name
,PAAPRV.last_name surname
,PAAPRV.assignment_id assignment_id
,PAAPRV.business_group_id business_group_id
,PAAPRV.assignment_number assignment_number
,PAAPRV.registered_employer legal_employer
,PAAPRV.abn abn
,PAAPRV.grade grade
,PAAPRV.payroll_id payroll_id
,PAAPRV.time_period_id time_period_id
,PAAPRV.period_start_date period_start_date
,PAAPRV.period_end_date period_end_date
,TO_CHAR(PAAPRV.period_start_date,'DD-Mon-YYYY') period_start_display
,TO_CHAR(PAAPRV.period_end_date,'DD-Mon-YYYY') period_end_display
,PAAPRV.period_number || ' ' || TO_CHAR(PAAPRV.period_end_date,'YYYY') period_number
,TO_CHAR(PTP.regular_payment_date,'DD-Mon-YYYY') pay_date
,PAAPRV.date_earned date_earned
,PAAF.ass_attribute2 legacy_position
,HR_GENERAL.DECODE_LOOKUP('EMPLOYEE_CATG',PAAF.employee_category) paypoint
,PPB.name salary_basis
,PAAF.people_group_id people_group_id
,PAAF.collective_agreement_id cagr_id
FROM pay_au_asg_payment_runs_v PAAPRV
,per_time_periods PTP
,per_all_assignments_f PAAF
,per_pay_bases PPB
WHERE PAAPRV.time_period_id = PTP.time_period_id
AND PAAPRV.assignment_id = PAAF.assignment_id
AND PAAF.pay_basis_id = PPB.pay_basis_id
AND PAAPRV.date_earned BETWEEN PAAF.effective_start_date AND PAAF.effective_end_date
AND PAAPRV.assignment_action_id = :P_ASSIGNMENT_ACTION_ID
]]>
</sqlStatement>
<sqlStatement name="Q_EARNINGS_DEDUCTIONS">
<![CDATA[
SELECT PAI.locking_action_id assignment_action_id_elements
,PRR.assignment_action_id assignment_action_id_run_ele
,PRR.run_result_id run_result_id
,PPA.effective_date effective_date_run
,PAAF.pay_basis_id pay_basis_id
,PETF.element_type_id element_type_id_ele
,NVL(PETF.reporting_name
,PETF.element_name) element_name_ear_ded
,PIVF.input_value_id input_value_id
,PEC.classification_name classification_name
,PRRV.result_value amount_elements
,DECODE( PEC.classification_name
, 'Earnings' , 1
,'Pre Tax Deductions' , 2
,'Involuntary Deductions' , 3
,'Voluntary Deductions' , 3 ) sort_order_elements
,CASE NVL(PETF.reporting_name
,PETF.element_name)
WHEN 'Salary' THEN 1
ELSE 2
END sort_order_name
,DECODE( PEC.classification_name
,'Earnings',1
,0
) earnings_count
,DECODE( PEC.classification_name
,'Earnings',0
,1
) deductions_count
FROM pay_action_interlocks PAI
,pay_assignment_actions PAA
,pay_payroll_actions PPA
,per_all_assignments_f PAAF
,pay_run_results PRR
,pay_run_result_values PRRV
,pay_input_values_f PIVF
,pay_element_types_f PETF
,pay_element_classifications PEC
WHERE PAI.locked_action_id = PAA.assignment_action_id
AND PAA.payroll_action_id = PPA.payroll_action_id
AND PAA.assignment_id = PAAF.assignment_id
AND PAA.assignment_action_id = PRR.assignment_action_id
AND PRR.run_result_id = PRRV.run_result_id
AND PRRV.input_value_id = PIVF.input_value_id
AND PRR.element_type_id = PETF.element_type_id
AND PETF.classification_id = PEC.classification_id
AND PPA.effective_date BETWEEN PAAF.effective_start_date AND PAAF.effective_end_date
AND PPA.effective_date BETWEEN PETF.effective_start_date AND PETF.effective_end_date
AND PPA.effective_date BETWEEN PIVF.effective_start_date AND PIVF.effective_end_date
AND PPA.action_type IN ( 'R','Q' )
AND PRR.status IN ('P','PA')
AND PEC.classification_name IN ( 'Earnings'
,'Pre Tax Deductions'
,'Involuntary Deductions'
,'Voluntary Deductions')
AND PIVF.name = 'Pay Value'
AND PAI.locking_action_id = :assignment_action_id
ORDER BY sort_order_elements ASC, sort_order_name ASC
]]>
</sqlStatement>
</dataQuery>
<dataTrigger name="beforeReport" source="XXLCPAY_ONLINEPAYSLIP_PKG.BEFORE_REPORT" />
<dataStructure>
<group name="G_PAYMENT_RUN" source="Q_PAYMENT_RUN">
<element name="assignment_action_id" value="assignment_action_id"/>
<element name="payroll_action_id" value="payroll_action_id"/>
<element name="run_assignment_action_id" value="run_assignment_action_id"/>
<element name="run_payroll_action_id" value="run_payroll_action_id"/>
<element name="person_id" value="person_id"/>
<element name="full_name" value="full_name"/>
<element name="surname" value="surname"/>
<element name="assignment_id" value="assignment_id"/>
<element name="business_group_id" value="business_group_id"/>
<element name="assignment_number" value="assignment_number"/>
<element name="legal_employer" value="legal_employer"/>
<element name="abn" value="abn"/>
<element name="grade" value="grade"/>
<element name="payroll_id" value="payroll_id"/>
<element name="time_period_id" value="time_period_id"/>
<element name="period_start_date" value="period_start_date"/>
<element name="period_end_date" value="period_end_date"/>
<element name="period_start_display" value="period_start_display"/>
<element name="period_end_display" value="period_end_display"/>
<element name="period_number" value="period_number"/>
<element name="pay_date" value="pay_date"/>
<element name="date_earned" value="date_earned"/>
<element name="legacy_position" value="legacy_position"/>
<element name="paypoint" value="paypoint"/>
<element name="salary_basis" value="salary_basis"/>
<element name="people_group_id" value="people_group_id"/>
<element name="cagr_id" value="cagr_id"/>
<group name="G_EARNINGS_DEDUCTIONS" source="Q_EARNINGS_DEDUCTIONS">
<element name="assignment_action_id_elements" value="assignment_action_id_elements"/>
<element name="assignment_action_id_run_ele" value="assignment_action_id_run_ele"/>
<element name="run_result_id" value="run_result_id"/>
<element name="effective_date_run" value="effective_date_run"/>
<element name="pay_basis_id" value="pay_basis_id"/>
<element name="element_type_id" value="element_type_id"/>
<element name="element_name_ear_ded" value="element_name_ear_ded"/>
<element name="input_value_id" value="input_value_id"/>
<element name="classification_name" value="classification_name"/>
<element name="amount_elements" value="amount_elements"/>
<element name="sort_order_elements" value="sort_order_elements"/>
<element name="sort_order_name " value="sort_order_name "/>
<element name="earnings_count" value="earnings_count"/>
<element name="deductions_count" value="deductions_count"/>
<element name="calc_values" value="XXLCPAY_ONLINEPAYSLIP_PKG.CALC_VALUES(67772)"/>
<element name="calc_values1" value="XXLCPAY_ONLINEPAYSLIP_PKG.RETURN_TEST"/>
<element name="calc_values2" dataType="number" value="XXLCPAY_ONLINEPAYSLIP_PKG.P_TEST" function="XXLCPAY_ONLINEPAYSLIP_PKG.P_TEST"/>
</group>
</group>
<element name="calc_values3" dataType="number" value="XXLCPAY_ONLINEPAYSLIP_PKG.P_TEST"/>
</dataStructure>
</dataTemplate>
CREATE OR REPLACE PACKAGE XXLCPAY_ONLINEPAYSLIP_PKG
AS
P_TEST NUMBER;
P_ASSIGNMENT_ACTION_ID NUMBER;
FUNCTION BEFORE_REPORT RETURN BOOLEAN;
FUNCTION RETURN_TEST RETURN NUMBER;
FUNCTION RETURN_TEST1 RETURN NUMBER;
FUNCTION RETURN_TEST2 RETURN NUMBER;
FUNCTION CALC_VALUES(element_type_id number) RETURN NUMBER;
END XXLCPAY_ONLINEPAYSLIP_PKG;
CREATE OR REPLACE PACKAGE BODY XXLCPAY_ONLINEPAYSLIP_PKG
AS
P_TEST1 NUMBER;
P_TEST2 NUMBER;
FUNCTION BEFORE_REPORT RETURN BOOLEAN
IS
BEGIN
P_TEST := 2;
FND_FILE.PUT_LINE(FND_FILE.LOG,'From Before Report');
RETURN(TRUE);
END BEFORE_REPORT;
FUNCTION RETURN_TEST RETURN NUMBER
IS
BEGIN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Call 1');
RETURN(P_TEST);
END RETURN_TEST;
FUNCTION CALC_VALUES(element_type_id number) RETURN NUMBER
IS
BEGIN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Call 2');
p_test1 := null;
p_test2 := null;
if ( element_type_id = 67772 ) then
P_TEST1 := 5;
P_TEST2 := 7;
elsif (element_type_id = 67804 ) then
P_TEST1 := 9;
P_TEST2 := 11;
end if;
RETURN(1);
END CALC_VALUES;
FUNCTION RETURN_TEST1 RETURN NUMBER
IS
BEGIN
RETURN(P_TEST1);
END RETURN_TEST1;
FUNCTION RETURN_TEST2 RETURN NUMBER
IS
BEGIN
RETURN(P_TEST2);
END RETURN_TEST2;
END XXLCPAY_ONLINEPAYSLIP_PKG;
/For this, you need to have a master query and child query.
1) In your master query you will have to identify one unique column and call a pl/sql pkg function which calculates all values for your place holder columns and inserts rows into a pl/sql table with the index as your unique column
ex: Master query returns
empnum name amount
1 scott 250
2 bob 350
and your calculated value is 10 percent of the amount
your pl/sql pkg should insert records into the pl/sql table like r(1):= 250*0.1 = 25 r(2):= 350*0.1 = 35
2) The child query will get executed for each row of you rmaster query, so you should be able to read the values based on which master records row it is executing for
Please bear in mind that you have to make sure that the report is not executed by two different people at the same time, else you have to consider session or any other unique identifier in addition to your master records unique identifier.
Cheers,
Girish. -
Hi,
I am using a data template plus CP combination to generate XMLP reports. From CP i am passing a standard date parameter to the data template. The issue is that there seems to be a problem accesing this variable in the data template SQL where conditions.
for ex:-
The value that CP passes => "2007-05-11 00:00:00.0"
In data template the parameter is like <parameter name="endDate" dataType="date"/>
The where condition is like h.end_date <= nvl(:endDate,h.end_date)
Here :endDate is always null. Interestingly in the XML output the date value is displayed properly for the parameter endDate like <endDate>2007-05-11 00:00:00.0</endDate>
What is the issue here. Pls. suggest on how to handle dates.
Thanks,
Suresh.Hi,
I am using a data template plus CP combination to generate XMLP reports. From CP i am passing a standard date parameter to the data template. The issue is that there seems to be a problem accesing this variable in the data template SQL where conditions.
for ex:-
The value that CP passes => "2007-05-11 00:00:00.0"
In data template the parameter is like <parameter name="endDate" dataType="date"/>
The where condition is like h.end_date <= nvl(:endDate,h.end_date)
Here :endDate is always null. Interestingly in the XML output the date value is displayed properly for the parameter endDate like <endDate>2007-05-11 00:00:00.0</endDate>
What is the issue here. Pls. suggest on how to handle dates.
Thanks,
Suresh. -
Passing menu selections as parameters to Data Template
Hi,
Following is my data template where i am passing 3 parameters - product_names(drop down menu, with option of multiple select with All), balance_date and trailing_days:
<dataTemplate name="ProductTrendDataTemplate" description="Product Trend Report" dataSourceRef="PI reporting DS">
<properties>
<property name="include_parameters" value="false"/>
<property name="include_null_Element" value="false"/>
<property name="include_rowsettag" value="false"/>
<property name="scalable_mode" value="off"/>
</properties>
<parameters>
<parameter name="product_names"/>
<parameter name="balance_date" dataType="date"/>
<parameter name="trailing_days" dataType="number" defaultValue="30"/>
</parameters>
<dataQuery>
<sqlStatement name="settlementlvl">
<![CDATA[
select
to_char(eff_d , 'MM/DD/YYYY') as settlement_date,
prdt_nm as product_name,
sum(tt_now_mmda_bal_a) as balance,
sum(acc_cnt) as account_count,
to_char(latest_settlement_date, 'MM/DD/YYYY') as latest_run_date
from
<tables>
where
prdt_nm in (:product_names)
and eff_d <= nvl(cast(:balance_date as date), (select max(eff_d) from t_frdba_daily_bal_f))
and eff_d >= nvl(cast(:balance_date as date), (select max(eff_d) from t_frdba_daily_bal_f)) - :trailing_days
group by eff_d, prdt_nm, latest_settlement_date
order by eff_d, prdt_nm
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="SETTLE_INFO" source="settlementlvl">
<element name="SETTLE_DATE" value="settlement_date"/>
<element name="PRODUCT_NAME" value="product_name"/>
<element name="BAL" value="balance"/>
<element name="ACCNTS" value="account_count"/>
<element name="LATEST_SETTLEMENT_DATE" value="latest_run_date"/>
</group>
</dataStructure>
</dataTemplate>
The parameter definition in the xdo document is as follows:
<parameters>
<parameter id="balance_date" dataType="xsd:date">
<date label="Latest Settlement Date" format="dd-MMM-yy"/>
</parameter>
<parameter id="trailing_days" defaultValue="90" dataType="xsd:integer">
<input label="Trailing Days" size="4"/>
</parameter>
<parameter id="product_names" defaultValue="*">
<select label="Products" valueSet="product_list" multiple="true" all="true" allValue="lov"/>
</parameter>
</parameters>
My problem pertains to the parameter product_names. When I select either All or multiple product_names (that is when I select product X,Y and Z from the front end), the product names are passed in as a single string into the query. As a result of this the query prdt_nm in (:product_names) fails as it trys to find all the product_names with value "'X','Y','Z'" instead of selecting on values 'X', 'Y', 'Z' separately. Thus the query is failing for multiple select. Can anyone suggest as how to handle this condition?
Please let me know if you need more information on this....
Thanks,
AshwinTim,
The output from my OC4J terminal with debugger turned on is
The sql query at run time looked as: prdt_nm in (:product_names)
Parameter value substituted as:
[101609_022156559][][STATEMENT] 1: product_names:'X','Y','Z'.
So I assume that the data template recvd this parameter as an string " 'X','Y','Z' ".
Just out of curiosity, I tried the same without using data template , just using plain SQL query, the output from the OC4J terminal is as follows:
In the query the parameter product_names is replace as prdt_nm in (:product_names2905,:product_names2906,:product_names2907) and the values are substituted as
[101609_022637635][][STATEMENT] 1:X
[101609_022637635][][STATEMENT] 2:Y
[101609_022637635][][STATEMENT] 3:Z
So from this you can see that BI publisher is some how handling the data template's parameter parsing differently from plain sql query.
Tim, I am not familiar with pre-fetch triggers as I am new to PL/Sql. Is there someway to handle this at the query level instead of writing a PL/SQL function.
Appreciate your help.
Ashwin
Maybe you are looking for
-
Posting huge data on to JSP page using JSTL tags
Hi, I have one application where I have to post huge data (approximately 2000 rows of data) into JSP page. I am using JSTL tags and running on Tomcat 5. It is taking almost 20 to 25 seconds to load the entire page. Is it the optimal time to load or i
-
I have set up an Airport Express in my car so I can Airplay from my Iphone to the car stereo. My car has an aux jack I plug into from the airport express and it works great from Ipad, Iphone and Ipod Touch. BUT, since I have no internet connected t
-
Logging the entries daily into a Z table Vs Volume
Hi Experts, Am working on a Billing EXTRACTing report, in this system approximately 1,000 invoices will be created per day. After filtering the selection as per user selection criteria, approximately 200 (per day) invoices will be seleted by my repor
-
Workers throw security error when using File class
I am creating a program that is writing/reading large files using the FileStream class. This portion works fine but when I want to use concurrency to prevent the UI from locking it fails. When I check inside Adobe Scout I can see the worker fires a
-
Re: Too many threads?
It would depend on the type of application and the target platform but I would certainly agree that 20 would be plenty for the vast majority of circumstances. Writing a Thread pool conforming to the following interface (for example) is quite straight