Using Common Table Expressions in BO Universe
Hi All,
How to use Using Common Table Expressions(CTE) in BO Universe ?
i created the stored procedure and tried to use it in universe but i'm not able to.
Request you to help me out with this.
Regards,
Ravichandra K
Did you get a chance to look at this guide chapter 7?
[http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_designer_en.pdf]
Bashir Awan
Similar Messages
-
Create a view using common table expressions
I'm having trouble finding out if this is even possible in Oracle.
Here is what I'm trying to accomplish with my view. A subject takes a survey numerous times across numerous dates. Depending on the responses to different questions, that subject is marked as having a set disease or affliction. The view that I'm building collects the necessary answers for each survey into one place (the first common table expression), then in subsequent CTEs, I'm adding the disease classification when the responses to the needed questions match. Sometimes the requirements state that the survey can't already be positive for other diseases, meaning that I need to ultimately discount them when checking subsequent diseases (each disease is built using it's own CTE of which there are 13). I built the query which performs these tasks with no problems. It runs and gives the responses that I'm looking for.
The problem comes into play when I attempt to wrap the existing working query into a create view process. When I add CREATE OR REPLACE VIEW TESTENV.TESTVIEW AS ( and the ending ); after the query, it is giving me the error: ORA-32034: unsupported use of WITH clause.
Am I getting the error simply because I can't put CTE's into views, or is it because the syntax for putting CTEs into Views is different than a normal view build process? Also, in case it makes a difference, the version of Oracle I'm using is: Oracle 10g.
Thank you.Here is the view that I'm trying to build:
<pre class="jive-pre">
CREATE OR REPLACE VIEW GI_DEV.PAIN_COMP AS (
WITH gatheredQuestions AS (
SELECT
s.date_of_survey_id,
a.question_1 as A_1,
a.question_5 as A_5,
a.question_6 as A_6,
a.question_7 as A_7,
a.question_8 as A_8,
a.question_9 as A_9,
a.question_10 as A_10,
a.question_12 as A_12,
a.question_13 as A_13,
a.question_14 as A_14,
a.question_15 as A_15,
a.question_16 as A_16,
b.question_1 as B_1,
b.question_4 as B_4,
b.question_5 as B_5,
b.question_6 as B_6,
b.question_7 as B_7,
b.question_8 as B_8,
b.question_9 as B_9,
b.question_11 as B_11,
b.question_12 as B_12,
b.question_13 as B_13,
b.question_14 as B_14,
b.question_15 as B_15,
b.question_16 as B_16,
b.question_16a_a as B_16a_a,
b.question_16a_b as B_16a_b,
b.question_16a_c as B_16a_c,
b.question_16a_d as B_16a_d,
b.question_16a_e as B_16a_e,
b.question_16a_f as B_16a_f,
b.question_16b as B_16b,
c.question_1 as C_1,
c.question_2 as C_2,
c.question_3 as C_3,
c.question_8 as C_8,
c.question_9 as C_9,
c.question_10 as C_10,
c.question_11 as C_11,
c.question_11a as C_11a,
c.question_11b as C_11b,
d.question_1 as D_1,
d.question_2 as D_2,
d.question_3 as D_3,
d.question_4 as D_4,
d.question_5 as D_5,
d.question_5a as D_5a,
d.question_5b as D_5b,
d.question_5c as D_5c,
d.question_6 as D_6,
d.question_6a as D_6a,
d.question_6b as D_6b,
d.question_6c as D_6c,
d.question_6d as D_6d
FROM
new_date_of_survey s
LEFT OUTER JOIN new_section_a a on a.solid_visit_a_id = s.date_of_survey_id
LEFT OUTER JOIN new_section_b b on b.solid_visit_b_id = s.date_of_survey_id
LEFT OUTER JOIN new_section_c c on c.solid_visit_c_id = s.date_of_survey_id
LEFT OUTER JOIN new_section_d d on d.solid_visit_d_id = s.date_of_survey_id
), functDyspepsia as (
SELECT
date_of_survey_id,
'Functional Dyspepsia' as pain_type
FROM gatheredQuestions g
WHERE
g.A_1 in (4, 5)
and g.A_5 in (3, 4, 5, 6)
and g.A_6 in (0, 2, 3)
and (g.A_7 in (0, 2) and g.A_8 in (0,2))
and (g.A_9 in (0, 2) and g.A_10 in (0, 2))
), IBSLower as (
SELECT
date_of_survey_id,
'IBS Lower' as pain_type
FROM gatheredQuestions g
WHERE
g.B_1 in (3, 4, 5)
and g.B_4 in (2, 3, 4, 5, 6)
and 2 <= (CASE WHEN g.B_5 in (3, 4, 5) THEN 1 ELSE 0 END) + (CASE WHEN (g.B_6 in (3, 4, 5) and g.B_7 not in (3, 4, 5)) or (g.B_6 not in (3, 4, 5) and g.B_7 in (3, 4, 5)) THEN 1 ELSE 0 END) + (CASE WHEN (g.B_8 in (3, 4, 5) and g.B_9 not in (3, 4, 5)) or (g.B_8 not in (3, 4, 5) and g.B_9 in (3, 4, 5)) THEN 1 ELSE 0 END)
), IBSUpper as (
SELECT
date_of_survey_id,
'IBS Upper' as pain_type
FROM gatheredQuestions g
WHERE
g.A_1 in (3, 4, 5)
and g.A_5 in (3, 4, 5, 6)
and 2 <= (CASE WHEN g.A_6 in (3, 4, 5) THEN 1 ELSE 0 END) + (CASE WHEN (g.A_7 in (3, 4, 5) and g.A_8 not in (3, 4, 5)) or (g.A_7 not in (3, 4, 5) and g.A_8 in (3, 4, 5)) THEN 1 ELSE 0 END) + (CASE WHEN (g.A_9 in (3, 4, 5) and g.A_10 not in (3, 4, 5)) or (g.A_9 not in (3, 4, 5) and g.A_10 in (3, 4, 5)) THEN 1 ELSE 0 END)
), abMigraine as (
SELECT
date_of_survey_id,
'Abdominal Migraine' as pain_type
FROM gatheredQuestions g
WHERE
g.B_16 in (3, 4, 5)
and 2 <= ((CASE WHEN g.B_16a_a = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.B_16a_b = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.B_16a_c = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.B_16a_d = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.B_16a_e = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.B_16a_f = 2 THEN 1 ELSE 0 END))
and g.B_16b = 2
), lowerFunctAbPainSyndrome as (
SELECT
date_of_survey_id,
'Functional Abdominal Pain Syndrome - Lower' as pain_type
FROM gatheredQuestions g
WHERE
g.B_1 in (4, 5)
and g.B_4 in (3, 4, 5, 6)
and date_of_survey_id not in (select date_of_survey_id from functDyspepsia union select date_of_survey_id from abMigraine union select date_of_survey_id from IBSLower union select date_of_survey_id from IBSUpper)
and
((g.B_15 in (2,3,4,5) and 2 > ((CASE WHEN g.B_11 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_12 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_13 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_14 in (2,3,4,5) THEN 1 ELSE 0 END)))
or (g.B_15 not in (2,3,4,5) and 2 <= ((CASE WHEN g.B_11 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_12 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_13 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.B_14 in (2,3,4,5) THEN 1 ELSE 0 END))))
), upperFunctAbPainSyndrome as (
SELECT
date_of_survey_id,
'Functional Abdominal Pain Syndrome - Upper' as pain_type
FROM gatheredQuestions g
WHERE
g.A_1 in (4, 5)
and g.A_5 in (3, 4, 5, 6)
and date_of_survey_id not in (select date_of_survey_id from functDyspepsia union select date_of_survey_id from abMigraine union select date_of_survey_id from IBSLower union select date_of_survey_id from IBSUpper)
and
((g.A_16 in (2,3,4,5) and 2 > ((CASE WHEN g.A_12 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_13 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_14 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_15 in (2,3,4,5) THEN 1 ELSE 0 END)))
or (g.A_16 not in (2,3,4,5) and 2 <= ((CASE WHEN g.A_12 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_13 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_14 in (2,3,4,5) THEN 1 ELSE 0 END) + (CASE WHEN g.A_15 in (2,3,4,5) THEN 1 ELSE 0 END))))
), lowerFunctAbPain as (
SELECT
date_of_survey_id,
'Functional Abdominal Pain - Lower' as pain_type
FROM gatheredQuestions g
WHERE
g.B_1 in (3, 4, 5)
and g.B_4 in (3, 4, 5, 6)
and date_of_survey_id not in (select date_of_survey_id from functDyspepsia union select date_of_survey_id from abMigraine union select date_of_survey_id from IBSLower union select date_of_survey_id from IBSUpper union select date_of_survey_id from upperFunctAbPainSyndrome union select date_of_survey_id from lowerFunctAbPainSyndrome)
), upperFunctAbPain as (
SELECT
date_of_survey_id,
'Functional Abdominal Pain - Upper' as pain_type
FROM gatheredQuestions g
WHERE
g.A_1 in (3, 4, 5)
and g.A_5 in (3, 4, 5, 6)
and date_of_survey_id not in (select date_of_survey_id from functDyspepsia union select date_of_survey_id from abMigraine union select date_of_survey_id from IBSLower union select date_of_survey_id from IBSUpper union select date_of_survey_id from upperFunctAbPainSyndrome union select date_of_survey_id from lowerFunctAbPainSyndrome)
), functConstipation as (
SELECT
date_of_survey_id,
'Functional Constipation' as pain_type
FROM gatheredQuestions g
WHERE
2 <= ((CASE WHEN g.C_1 in (0, 2) THEN 1 ELSE 0 END) + (CASE WHEN (g.C_2 in (2,3) and g.C_3 <> 2) or (g.C_2 not in (2, 3) and g.C_3 = 2) THEN 1 ELSE 0 END) + (CASE WHEN g.C_8 = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.C_9 in (3, 4, 5) THEN 1 ELSE 0 END) + (CASE WHEN g.C_10 = 2 THEN 1 ELSE 0 END) + (CASE WHEN g.C_11 in (4, 5, 6) THEN 1 ELSE 0 END))
and date_of_survey_id not in (select date_of_survey_id from IBSLower union select date_of_survey_id from IBSUpper)
), fecalIncontinence as (
SELECT
g.date_of_survey_id,
'Nonretentive Fecal Incontinence' as pain_type
FROM
gatheredQuestions g
left outer join new_date_of_survey s on s.date_of_survey_id = g.date_of_survey_id
left outer join new_demographics d on d.solid_demographics_id = s.demo_id
WHERE
4 <= trunc((months_between(s.survey_date, d.date_of_birth))/12)
and g.C_11 in (4, 5, 6)
and g.C_11a in (2, 3)
and g.C_11b in (3, 4, 5, 6)
and g.date_of_survey_id not in (select date_of_survey_id from functConstipation)
), aerophagia as (
SELECT
date_of_survey_id,
'Aerophagia' as pain_type
FROM gatheredQuestions g
WHERE
2 <= ((CASE WHEN (g.D_1 in (3, 4, 5) and g.D_2 not in (3, 4, 5)) or (g.D_1 not in (3, 4, 5) and g.D_2 in (3, 4, 5)) THEN 1 ELSE 0 END) + (CASE WHEN g.D_3 in (3, 4, 5) THEN 1 ELSE 0 END) + (CASE WHEN g.D_4 in (3, 4, 5) THEN 1 ELSE 0 END))
), cycVomitSyndrome as (
SELECT
date_of_survey_id,
'Cycllic Vomiting Syndrome' as pain_type
FROM gatheredQuestions g
WHERE
g.D_5 in (4, 5)
and g.D_5a in (3, 4, 5, 6)
and g.D_5b = 2
and g.D_5c = 2
), adolRumSyndrome as (
SELECT
date_of_survey_id,
'Adolescent Rumination Syndrome' as pain_type
FROM gatheredQuestions g
WHERE
g.D_6 in (4, 5)
and g.D_6a = 2
and g.D_6b = 0
and g.D_6c = 0
and g.D_6d = 0
), gatheredPains as (
+
select * from functDyspepsia
union
select * from IBSLower
union
select * from IBSUpper
union
select * from abMigraine
union
select * from lowerFunctAbPainSyndrome
union
select * from upperFunctAbPainSyndrome
union
select * from lowerFunctAbPain
union
select * from upperFunctAbPain
union
select * from functConstipation
union
select * from fecalIncontinence
union
select * from aerophagia
union
select * from cycVomitSyndrome
union
select * from adolRumSyndrome
SELECT
date_of_survey_id,
string_agg(pain_type) as PainType
FROM gatheredPains
GROUP BY date_of_survey_id
</pre>
I tried remove the leading and ending parenthesis, and ended up getting the error that it is missing the select keyword. When I take the create view step out of this, the query builds with no problem, so I know that it's not missing a select or that it isn't in the correct place.
Thank you for all your help so far. -
Using Common Table Expressions (CTE) in a DSV Named Query
Hi,
I have a scenario where I need to "generate" fact data, so I'm using a CTE to generate the data. For maintainability reasons I have this CTE declared inside a view and in the DSV Named Query I just have a SELECT * FROM FactView.
This works fine as long as the recursion level falls within the default limit of 100. If it does not, I have to specify the maximum recursion level such as:
SELECT *
FROM FactView
OPTION (MAXRECURSION 0)
The problem is I can't specify the Named Query like this. As explained elsewhere my query is embeded as a subquery and the OPTION keyword cannot be used in a subquery.
Is there any other way I can specify the maximum recursion level on a Named Query?Load your fact table data into staging table and then process fact using direct load from staging table.
-
Extracting Metadata using Common Table Expressions MSSQL
I have been using the below SQL query to extract subsets of the Metadata structure from several dimensions in HFM. The process works well and is simple/quick to develop and incorporate in existing processes. I am curious if anyone else has been using a similar query to extract subsets of HFM Structure directly from HFM or other approaches to extract a subset of HFM Structure.
/* The query starts with a "Top Parent" and will return all parent/child information below that member. For this example I want all the metadata for the c1 dimension so I am using the top most parent which by default has an ID of -1. You can look up and member's id in the "APP_DIM_Item" table and use that as the "Top Parent" for the query. It is possible to correctly extract only a subset of the overall metadata for each dimension.
WITH dim (ItemID, ParentID, Level)
AS
SELECT
el.ItemID
,el.[ParentID]
,0 AS Level
FROM [<APP>CUSTOMLAYOUT] el
WHERE ParentID = -1 -- The "Top Parent" -1 will extract all metadata
and lDimID = 1 -- Needed only for the custom dimensions.
UNION ALL
SELECT
el.ItemID
,el.ParentID
,Level + 1 as Level
FROM [ <APP>_CUSTOM_LAYOUT] el
INNER JOIN dim AS d
ON el.ParentID = d.ItemID
where el.lDimID = 1 -- needed for the custom dimensions
/* Once the structure is extracted to the temp dim table you can query back and
join to the Item table to add addtional memeber details. If you leave the query as
is you will only see the parent/child Unique ID and level informtaion.
-- Parent/Child ID Structure
SELECT * FROM dim
-- Parent/Child Label Structure
Select Dim.ItemID, Dim.ParentID, Dim.Level, Member.Label, Parent.Label
From Dim
inner JOIN <APP>CUSTOMITEM Member -- Member Detail
on Member.ItemID = dim.ItemID AND Member.lDimID = 1
inner JOIN <APP>CUSTOMITEM Parent -- Parent Detail
on Parent.ItemID = dim.ParentID AND Parent.lDimID = 1Did you get a chance to look at this guide chapter 7?
[http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_designer_en.pdf]
Bashir Awan -
Memory usage Common table Expressions
Hope view will use temporary memory while using it.. and
If I use Common table Expressions (with <datsetname> select query )
in stored procedure instead of view will it use the temp memory ?
Many thanks
KalingaWhy would it be any different? Its still a query. It will use any memory available for sorting
(defined by sort_area_size)
and if it exceeds this it will use the temporary tablespace.
If their is more than one temporary tablespace , it will use the temporary tablespace which that user has been assigned. -
Hi,
In DB2, there is a concept called 'common table expressions'.
A common table expression is like a temporary view that is defined and used for the duration of an SQL statement. You can define a common table expression for the SELECT, INSERT, and CREATE VIEW statements. Each common table expression must have a unique name and be defined only once. However, you can reference a common table expression many times in the same SQL statement.
Eg :--
insert into test1 with test_view1(column2) as (select colum1 * 2 from test2) select column2 from test_view1;
Here 'test_view1' is a temporary view created with a select statement. This view has the scope only within this SQL statement. The data inserted into the table 'test1' is selected from the temporary view.
This can be achieved in Oracle by creating views and then using the INSERT .. SELECT statement. But I like to know whether any direct equivalent available for this in Oracle, something like 'INSERT .. WITH <view_name>' as in DB2.
Please advise,
Thanks,
SmithaEr...you mean like this?
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
JServer Release 9.2.0.6.0 - Production
SQL> INSERT INTO emp
2 WITH v_emp AS
3 (SELECT empno + 1, ename, job, mgr,
4 hiredate, sal, comm, deptno
5 FROM emp)
6 SELECT *
7 FROM v_emp;
14 rows created.
SQL> No, nothing like that whatsoever. -
Datatypes in a recursive common table expression
I'm trying to use a (recursive) common table expression to generate a list of dates. The following code is working fine with 11.2
WITH dates ( nr, dt ) AS (
SELECT 1, DATE '2005-02-01'
from dual
UNION ALL
SELECT d.nr + 1, DATE '2005-02-01' + 1
FROM dates d
WHERE d.nr < 30
SELECT dt
FROM dates;But I would like to avoid repeating the start date in the recursive part, and I tried the following:
WITH dates ( nr, dt ) AS (
SELECT 1, DATE '2005-02-01'
from dual
UNION ALL
SELECT d.nr + 1, d.dt + 1
FROM dates d
WHERE d.nr < 30
SELECT dt
FROM dates;But I get the following error: ORA-01790: expression must have same datatype as corresponding expression
Now from my understanding the datatype should be DATE for both parts of the UNION.
I also tried it with d.dt + interval '1' day but that produces the same error message. using to_date() instead of the ANSI date literal does not change it either.
What am I missing here?castorp wrote:
I'm trying to use a (recursive) common table expression to generate a list of dates. The following code is working fine with 11.2
WITH dates ( nr, dt ) AS (
SELECT 1, DATE '2005-02-01'
from dual
UNION ALL
SELECT d.nr + 1, DATE '2005-02-01' + 1
FROM dates d
WHERE d.nr < 30
SELECT dt
FROM dates;But I would like to avoid repeating the start date in the recursive part, and I tried the following:
WITH dates ( nr, dt ) AS (
SELECT 1, DATE '2005-02-01'
from dual
UNION ALL
SELECT d.nr + 1, d.dt + 1
FROM dates d
WHERE d.nr < 30
SELECT dt
FROM dates;But I get the following error: ORA-01790: expression must have same datatype as corresponding expression
Now from my understanding the datatype should be DATE for both parts of the UNION.
I also tried it with d.dt + interval '1' day but that produces the same error message. using to_date() instead of the ANSI date literal does not change it either.
What am I missing here?http://www.orafaq.com/forum/mv/msg/95011/463394/102589/#msg_463394 -
What happens to unused common table expressions ,Does this affect in performance or ?
If I write a query with one or more common table expressions to which I
don't actually refer in the query, do they just get pruned off or do
they get executed regardless? how does it affect in performance
Prem ShahTry below
seems when the CTE is not refer in the query then statement inside CTE is not executing at all even if it nested CTE, see for your self
Create table UserInfo
UserId int primary key,
UserName varchar(30)
GO
Create table UserInfo1
UserId int primary key,
UserName varchar(30)
GO
insert into UserInfo
select 1001,'X1' union all
select 1002,'X2' union all
select 1009 ,'X9'
GO
insert into UserInfo1
select 1001,'X1' union all
select 1002,'X2' union all
select 1009 ,'X9'
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
Begin tran
select * from UserInfo1 where UserId between 1001 and 1009
and UserName = 'XXXX'
--Commit
PRINT 'WITH out CTE access in select'
SET STATISTICS IO ON
;WITH CTE1 AS
(Select * From UserInfo1)
select * From UserInfo
PRINT 'WITH CTE access in select'
;WITH CTE1 AS
(Select * From UserInfo1)
select * From UserInfo a inner join CTE1 b on a.UserId=b.UserId
Stats IO
WITH out CTE access in select
(3 row(s) affected)
Table 'UserInfo'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
(1 row(s) affected)
WITH CTE access in select
(3 row(s) affected)
Table 'UserInfo1'. Scan count 0, logical reads 6, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'UserInfo'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
(1 row(s) affected)
Thanks
Saravana Kumar C -
Derived tables with prompts - based universe
why can't I use derived tables with prompts - based universes on Dashboard Design 4.0? I mean I can add to Dashboard Design data coming from a universe like that but the prompts don't show in the query panel in Dashboard Design. Could it be becuase my universe was created first as an unv and then I transformed it to unx?
Good day Yuvraj,
Thank you for your response.
Basically, I have 2 classes based on physical tables:
Product (P); and
Time/Calendar (T/C).
Two classed based on derived tables:
Stock on Hand (SoH); and
Stock Movements (SM)
The derived tables SQL code selects (Quantity and Selling Price) from the SoH table and joins to the T/C table with conditions and a Where clause to restrict the data output to the last 2 months (the same applies to the SM derived table).
Example code below:
SELECT q.sm_table _no, q.tim_cal_no, q.quantity, q.selling_price
FROM tim_cal_table p,
sm_table q
WHERE q.tim_cal_no= p.tim_cal_no
AND p.day between to_char(sysdate - 60,'DD/MON/YY') and to_char(sysdate - 1,'DD/MON/YY');
Now, the SoH table and the SM table are joined (in the universe schema) to the P table and T/C table using Primary Keys (which are shared by all the tables - physical and derived i.e. foreign keys on the SoH and SM tables used in the derived tables).
Now to answer your questions:
Do you get data in case you take objects only from derived table class?NO
Does the columns used to join physical table and derived table has matching values? YES. I mean to say is the join getting satisfied? YES. Checked Universe Integrity - structure, objects, joins, conditions, loops, context and cardinalities - everything is OK.
Adding to this, is the data type same for both the columns (on which join is set) or is there any typecasting required? YES - checked the data types of the primary/foreign keys that join the tables and they all match, except for one on the SM table - the foreign key has 6 set for precision (instead of 5 as per the other columns), however the data type is Numeric so this shouldn't be an issue.
I hope this helps to clarify the nature of the problem.
Thank you.
Regards,
B -
How does one add tables to an existing universe using COM designer SDK.
Morning All
How does one add tables to an existing universe using COM designer SDK. I have tried:
objUniverse.Tables.Add (strTable_Name)
but get "Cannot create Table" error.
Any ideas?
Thanks in advance.
AnitaHi Anita,
-Use the Add method to add classes and objects to an existing universe using a VB 6 application.
Adding a Class
Definition: Function Add(Name As String) As Class
Syntax: NameOfClassesVariable.Add
Adding an Object Instance
Definition: Function Add(Name As String, [ClassName As String]) As Object
Syntax: NameOfObjectsVariable.Add(name, [class])
- name is the name of the object.
- class is the name of the class containing the object. This parameter should be used in cases where more than one objects exist with the same name.
Sample Visual Basic 6 Code
Dim DesApp As Designer.Application
'MODIFY AND EXPORT CLASSES AND OBJECTS OF AN EXISTING UNIVERSE
Sub modify_and_export_universe()
Dim DesUnv As Designer.Universe
Dim DesCls As Designer.Class
Dim DesObj As Designer.Object
Dim DesDBCol As Designer.DBColumn
Dim DBColName As String
Set DesApp = New Designer.Application
'Login to designer
Call DesApp.LogonDialog
'Make sure to log on with your administrator profile
'e.g : "hostname","username", "password","Enterprise"
'Make Designer application visible
DesApp.Visible = True
'This line disable warning messages from Designer
DesApp.Interactive = False
'to Open locally the universe you want to modify
'Set DesUnv = DesApp.Universes.Open("club_uni")
'Use OpenFromEnterprise method (Universes Class) to import a universe from the repository and opens it
Set DesUnv = DesApp.Universes.OpenFromEnterprise("Universes", "club_uni", False)
'Add a valid connection which already exists
DesUnv.Connection = "club"
'open the universe
'Call DesApp.Universes.Open("club_universe")
'Add the table Account and refresh the view in the main window
Set DesTab = DesUnv.DBTables.Item("Customer").Insert
DesUnv.ArrangeTables
'Add a class
Set DesCls = DesUnv.Classes.Add("Class MyCustomer")
'Looping through all the fields of the DB Table Account
For Each DesDBCol In DesUnv.DBTables.Item("Customer").DBColumns
'Store name of the column
DBColName = DesDBCol.Name
'Add an object to the class
Set DesObj = DesCls.Objects.Add("Obj " & DBColName)
'Affect a field to the object
DesObj.Select = "Customer" & "." & DBColName
Next
'Save the existing universe with the same name club_uni or you can change
DesUnv.SaveAs "club_uni"
MsgBox "Universe created and saved Class MyCustomer has been added!!"
'Close the universe
UnvFullName = DesUnv.FullName
MsgBox "The UniverseFilePath is " & UnvFullName
'Close the universe
DesUnv.Close
'This line disable warning messages from Designer
DesApp.Interactive = False
'Export the universe to the CMS DB (to the last universe folder)
'Make sure you save the universe before exporting it
Call DesApp.Universes.Export("Universes", UnvFullName)
MsgBox "This document has been exported successfully !!"
'Close designer
DesApp.Quit
Set DesApp = Nothing
End Sub
Hope this helps.
Regards,
Deepti Bajpai -
XML Publisher Report Fails While using Pivot Table in R12 Oracle EBS
Hello All,
Need your help. I am trying to create a report with a Pivot table. I have created the .rtf file using the Oracle BI Publisher Template Builder for word 10.1.3.4.1. the data comes correctly in preview but when i register it in EBS and run the concurrent program it competes in warning and no output is displayed.
The error message looks like as follows.
[9/3/10 4:03:17 PM] [19934:RT444621] Executing post-processing actions for request 444621.
[9/3/10 4:03:17 PM] [19934:RT444621] Starting XML Publisher post-processing action.
[9/3/10 4:03:17 PM] [19934:RT444621]
Template code: XXECOHCGEN
Template app: XXECO
Language: en
Territory: 00
Output type: EXCEL
[9/3/10 4:03:31 PM] [19934:RT444621] Output file was found but is zero sized - Deleted
[9/3/10 4:03:31 PM] [UNEXPECTED] [19934:RT444621] java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at oracle.apps.xdo.common.xml.XSLT10gR1.invokeNewXSLStylesheet(XSLT10gR1.java:611)
at oracle.apps.xdo.common.xml.XSLT10gR1.transform(XSLT10gR1.java:239)
at oracle.apps.xdo.common.xml.XSLTWrapper.transform(XSLTWrapper.java:182)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:1044)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:997)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:212)
at oracle.apps.xdo.template.FOProcessor.createFO(FOProcessor.java:1665)
at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:975)
at oracle.apps.xdo.oa.schema.server.TemplateHelper.runProcessTemplate(TemplateHelper.java:5936)
at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3459)
at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3548)
at oracle.apps.fnd.cp.opp.XMLPublisherProcessor.process(XMLPublisherProcessor.java:302)
at oracle.apps.fnd.cp.opp.OPPRequestThread.run(OPPRequestThread.java:176)
Caused by: oracle.xdo.parser.v2.XPathException: Namespace prefix 'crosstab' used but not declared.
at oracle.xdo.parser.v2.XSLProcessor.reportException(XSLProcessor.java:806)
at oracle.xdo.parser.v2.XSLProcessor.newXSLStylesheet(XSLProcessor.java:571)
... 17 more
would appreciate some pointers to fix this issue.
Regards,
Abhijeet K
Edited by: Abhijeet K on Sep 3, 2010 8:10 AMHI, was there a Solution Ever found for this post other than the Workaround.
I am at the Same issue now, Any Valuable inputs will Help me finish my Report ASAP, becos currently this is my only Show stopper
we have Oracle Apps R12 realease 12.1.3 we use XMLpublisher built in R12
The issue i have is .
I created a XMLPublisher Report using PIVOT TABLE i would like to have my output to be in Excel, When i Preview it works fine, when i execute via Concurrent Program it gives the Following Log file
XXTPC Custom Application: Version : UNKNOWN
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
TPC_ITEM_COUNT_RPT module: TPC ITEM COUNT RPT
Current system time is 25-JUN-2012 11:00:39
XDO Data Engine Version No: 5.6.3
Resp: 21676
Org ID : 101
Request ID: 2149483
All Parameters: report_name=RUN BY ORDER TYPE:org_name=HQF:org_choice=TPC US:item_selection=1001:order_type=k-us:pstatus=entered,waved,notwaved,shipped:transit_days=:first_receipt_date=01-jun-2012:last_receipt_date=22-jun-2012
Data Template Code: TPC_ITEM_COUNT_RPT
Data Template Application Short Name: XXTPC
Debug Flag: N
{first_receipt_date=01-jun-2012, org_choice=TPC US, item_selection=1001, report_name=RUN BY ORDER TYPE, pstatus=entered,waved,notwaved,shipped, org_name=HQF, last_receipt_date=22-jun-2012, order_type=k-us, transit_days=}
Calling XDO Data Engine...
Start of log messages from FND_FILE
End of log messages from FND_FILE
Executing request completion options...
Output file size:
29148
------------- 1) PUBLISH -------------
Beginning post-processing of request 2149483 on node HQTERPAS1LX at 25-JUN-2012 11:00:51.
Post-processing of request 2149483 failed at 25-JUN-2012 11:00:52 with the error message:
One or more post-processing actions failed. Consult the OPP service log for details.
------------- 2) PRINT -------------
Not printing the output of this request because post-processing failed.
Finished executing request completion options.
Concurrent request completed
Current system time is 25-JUN-2012 11:00:52
I have requested my DBA to get me the OPP file..
Thanks in advance for any solution. -
Working on ETL tools interoperability using Common Warehouse Model (CWM)
Hi All,
Its just a piece of information and not a question.
I have been working on proving the ETL tools interoperability using Common Warehouse Metamodel(CWM), an OMG standard. The whole concept is to take out the metadata from an ETL tool say OWB and put it into CWM Metadata Repository and this metadata can be used for building the same project in any other tool say Informatica or may be in the same ETL tool.
The main thing in this process is to map each ETL tool with the CWM concepts and then using Model to Model Tranformations(Technologies like Xtend) one can set up a communication between different ETL tools.
Till now I have worked with OWB only. I, with my team, have extracted all information from an OWB project (which has medium level of complexity like two oracle modules(schemas) and few tables, views and mappings with various operators) and put it in CWM repository and extracted it back from CWM MDR to OWB itself. We haven't worked with any other ETL tool because of the unavailablity of any other ETL tool with us. We will be working with Pentaho kettle in near future and try to prove the whole process as two way communication.
The whole process can be described in steps as below :
1. Creation of a manual OWB Ecore model(model representaion in Eclipse Modelling Framework) which gives all dependencies and reletionships in OWB objects like Project,OracleModule etc.
2. Creation of CWM ecore model from Rational Rose mdl which has been provided by OMG on their site.
3. Generation of Java code(Gen Model) from the above mentioned ecore model(It is needed to create an object from OWB).
4. Extraction of project from OWB using public views which has been exposed by OWB itself. You can refer to [http://download.oracle.com/docs/cd/B31080_01/doc/owb.102/b28225/toc.htm|http://download.oracle.com/docs/cd/B31080_01/doc/owb.102/b28225/toc.htm] link for OWB public views and other APIs.
5. (Actually Step 4 is a part of this step only )Writing a Java code which has JDBC connection for accessing OWB public views and Ecore model as imported java files(Step 3 has been done for this part only). This java code will return an OWB project object(instance of the Ecore model) which will be used in further steps.
6. Writing an Xtend code to do a model to model tranformation from OWB to CWM.
7. Writing an Open Architecture Workflow to combine all the steps in one step which will take the output of java code(step 5) and put it into Xtend Code(step 6) and then will take the output of Xtend code and give it to the XMIWriter(an OAW component) to write an XMI which is actually a CWM Ecore Model instance.
8. Saving above XMI(CWM model instance) to the CWM MDR using Hibernate and Teneo.
In the same way we can extract metadata from CWM MDR and put it into OWB. But the only problem with OWB is that we cannot persist OWB object in OWB repositories as OWB tables are very cryptic and tough to understand. So for that we have used TCL scripts(OMB Plus scripts) to create a project in OWB using OWB ecore instance. You can refer to the above oracle documentation link for TCL scripts.
Let me know if I can assist you if you are working on the same.
You can mail me for any queries. My email id is [email protected].
Thanks,
DeepakHi
1. Why do we need to install another standalone HTTP server in a separate home? Where do we use that server?
DA: The separate HTTP server is for the Workflow Monitor, which is not necessary (it has some use cases mind you).
2. To make the OWB work correctly while using ETL features, do we always need to run Workflow Configuration Assistant, because I wasn't able to generate code from OWB editor after building a mapping while Workflow Configuration Assistant wasn't running.
DA: Not necessary, what error did you get? Mappings can be designed, deployed and executed without Workflow. Workflow can be used for orchestrating the the mappings (ie .running a bunch of them in a specific order with others tasks).
3. Whenever I try to save my work in OWB, I get an error , message : Preference.properties (Access is denied). Though it saves my work but I don't understand why I am getting this error. It looks like OWB is trying to access some Property from the Preferences (Tools menu) but can't access.
DA: It sounds like the directory where you have installed OWB does not have permissions for the OS user you are executing it. Is the install user different from the execution user? Either run using the installed user, or change the permissions of the directories (grant the executing user write permissions under all directories under owb).
4. I also get error while closing the Mapping Editor :-
DA. same issue as 3.
Cheers
David -
What are the Pros and Cons while joining tables at DF and Universe level
Hi Experts,
I am new to Data federator designer. I need help on the below.
Could you please let me know the Pros and Cons while joining the source tables in data federator
And While joining the DF target tables in universe designer.
Regards,
GanaHi,
1. I have created target tables based on source tables with one to one mapping and then join all target tables in universe.
Ex: Source tables: Infocube text tables, fact tables and 3rd party data base table
Target tables:Target tables are same as source tables
--- Yes this is the way to create target Tables and join them in the universe.These target Tables gives you the flexibility like in future your requirement is to add one more object based on some calculation which is not possible in the universe so that time you can create one more column in the target table and do the calculation. at the same time if you are using source table you can not do anything.
2. Created single target table with all objects of source tables and merged all sources tables data.
Ex: Source tables: Infocube text tables, fact tables and 3rd party data base table
Target table: Single table.
--- This is bit complex structure to merge all tables data in the one target table.in this situation you have to put more efforts and it is more complex.basically this type of target table is useful when you are merging data by multiple source into single or creating one target table based on the union of tables by adding two mapping rules or more and you can not join tables in universe.
Better approach is first 1. create target tables based on the source tables and join them in the universe.
Thanks,
Amit -
How to use "Routing Table" option in Proxy service in OSB ?
Hi,
I have created Business and Proxy services in my OSB console. I have used "Custom Query" option while creating the Database Adapter and I'm passing one input parameter to the query. My input parameter is "Name".
Based on the input values for this parameter, I need to pass a corresponding values to the query. For example, If I pass the following values to "Name" input parameter (India) I need to pass "Value1" to my query -
India --> Value1
China --> Value2
America --> Value3
To achieve this requirement, I have used "Routing Table" option. I have specified the values as follows -
Expression - $body/fet:FetchCustDataInput/fet:Name
Operator- '='
Compare value - India
Service - "My Webservice"
Operaton- "My Service Operation"
In the "Request Actions:" I have added the "Add an Action --> Messaging Processing --> Replace" and provided the following values -
Replace <XPath> = $body/fet:FetchCustDataInput/fet:Name
in Variable = "Name"
with Expression = xs:string('Value1')
and selected "Replace node contents" option.
No validation errors I faced. I have created the Routing table in Proxy service. But when I try to execute the proxy service in my Test Console, I get the following error message -
"The invocation resulted in an error: Unknown error while processing message for service ProxyService OSBQueryService/FetchByCustomQuery/FetchByCustomQueryPS."
I have even enabled "Direct call" and "Include Tracing" options as well. The message under "Tracing" give "(echoing request)
Routed Service. No Service has been invoked, the request is echoed.".
Can anyone please help me to resolve this issue.
Thanks in Advance,
UdayaDid you put any loggers in the proxy at request pipeline prior to route node ? Can you trace if the request has entered request pipeline aleast.
If not just check the transport headers under the request window in the test console. There should be a text box for entering username/password which should be left blank. I have faced this unknown exception from test console in some browsers where an incorrect username/password used to get populated here. Check this ..
Edited by: atheek1 on Jul 22, 2010 2:02 AM -
Using Oracle Database Express Edition in development environment
Hi All,
I have doubt regarding the usage Oracle Database Express Edition in Development environment. I am not sure weather I can ask a non technical question here or not. Pleas forgive me if I have done any thing wrong.
I am working in an IT company where we take up projects outsourced by our clients. As part of our current project we are making some modification to a web application used by an institution. Our client is using Oracle Data Base standard edition. Due to budgetary constraints of our Company we can not set up a Oracle standard edition data base in our development environment.
So would it be illegal if we use Oracle Database Express Edition in our development environment? We can guarantee that only our internal development team which comprise a maximum of 10 people will have access to this development database and this development data base will never be opened to our Client for their business purpose(Who have their own Oracle standard edition in their environment). As part of the project we delver only table DDL script and stored procedure to our client and they put it in their environment.The sole purpose of a internal Express database will be development only.
Could some one please tell me if it would be violation of license agreement if we install Oracle Database Express Edition in our development environment.Hi Paul,
Actually I have already gone through the Oracle Technology Network Developer License Terms for Oracle Database 11g Express Edition . But was not quiet clear about the content. It says in the license terms that "We grant you a nonexclusive, nontransferable limited license to use the programs for: (a) purposes of developing, prototyping and running your applications for your own internal data processing operations". Does the term "your application" includes an application we are developing for another company. Since the Express database is installed in the development environment only and is not opened to any one else not even for Our client it definitely falls under the term "internal data processing operations" right?
Maybe you are looking for
-
Recent Safari 1.3.2 Problems
On one of my Mac's, I am still running Mac OX 10.3.9 and, consequently, have Safari 1.3.2. Recently (in the last 3-4 months) I have been starting to see some problems. Most notably, Google Maps no longer works and trying it results in Safari crashing
-
Query on Microsoft Windows 8.1 Pro Upgrade Licensing
I am upgrading from Windows XP OEM to Windows 8.1 Upgrade paper license. Does these upgraded paper of Windows 8.1 would still be valid if I discard OEM machine after 1-2 year? Or upgrade license would be legally invalid once actual machine will be d
-
See: http://www.adobe.com/support/techdocs/2aa72.htm
-
Does a Gbit ethernet disk work with FCE
I am new to video editing and now looking for an external harddisk. What I have read here a Firewire drive is better than USB-2. I could not find any information if FCE 4 will work with a network drive, such as the LaCie Ethernet Disk 500GB - with Gi
-
Thanks for the help for the interview questions. Now my second step is that I want to start practice writing pl/sql code. Any one can suggest on some small projects or something on those lines.