Tree Query in htmldb 1.6
Hi,
I am a new HTMLDB User, trying to use Tree feature. I am trying to create a tree with the following query, but the tree results in the first record only. Awaiting your valuable response.
SQL> desc opptable
Name Type Nullable Default Comments
OPP_CODE VARCHAR2(20)
CAM_OPP_CODE VARCHAR2(20) Y
OPP_SHORT_NAME VARCHAR2(15) Y
SQL> select * from opptable;
OPP_CODE CAM_OPP_CODE OPP_SHORT_NAME
BIGOP BIGOP Big Opportunity
BIGOPPORTUNITY BIGOPPORTUNITY chk size
LT01 LT01 laptop
OPP1 OPP1 opportunity tst
OPP2 OPP2 soupy snax-OPP
OPPSA OPPSA Test Opp - SAD
OPR1 OPR1 test oppr
REC REC Recruit Ind
regards
Hi ,
Here is the tree query:
select "OPP_CODE" id,
"CAM_OPP_CODE" pid,
"OPP_SHORT_NAME" name,
null link,
null a1,
null a2
from "#OWNER#"."OPPTABLE"
regards
Similar Messages
-
Calling boolean function from tree query
Hi all,
I have placed a tree on my sidebar region from the following query
select PAGE_NO id,
PARENT_PAGE_NO pid,
NAME name,
'f?p=&APP_ID.:'||page_no||':&SESSION.' link,
null a1,
null a2
from #OWNER#.APEX_PAGES
WHERE page_no = :APP_PAGE_ID
AND nvl(navigation,'N') = 'Y'
Its running perfectly fine. Now i have my custom function "isUserAllowed(app_user, name_of_node, isParent)" which returns a boolean expression is the logged in User has access privilege on that node.
How can i run my function inside the tree query so that node is visible only for those values in which my function returns "true"? and not on others?
With Regards,
Sunil BhatiaThe "wrapper" function would actually be pretty easy - just another function to call the one returning the boolean and convert it to some other value, numeric or character. something like (untested)
<pre>
FUNCTION wrapper_function(P_whatever varchar2) return varchar2 IS
v_return_value_c varchar2(5);
BEGIN
r_return_value_c := case boolean_function(p_whatever)
when true then 'true'
else 'false;
return v_return_value_c;
END;
</pre>
Using the function in the WHERE clause could look something like this (untested, but should work if done correctly)
<pre>
select whatever
from your_table
where wrapper_function(whatever) = 'true'
</pre> -
I've problem with tree query where if a level > 3 the result for top level is incorrect.
Here's the query with correct result where level of depth just 3 level :
--select *from tblBOMStructed
DECLARE @BOMStructure TABLE
PartNumber varchar(14)not null ,
Descript varchar(50)not null,
Qty integer not null default 0,
Price Decimal (10,2) default 0,
TotalPrice Decimal (10,2) default 0,
ItemNumber varchar(14) not null primary key
INSERT @BOMStructure
(PartNumber ,Descript ,Qty ,Price ,ItemNumber)
VALUES ('00150060060005','BASIC TANK',1,0,'1'),
('11012142200503','SHELL',1,789.89,'1.1'),
('12052140503','TOP CONE',1,226.75,'1.2'),
('13052140503','BOTTOM CONE',1,226.75,'1.3'),
('140104116508','PIPE LEG',3,39.75,'1.4'),
('15004104','BALL FEET',3,0,'1.5'),
('1510413504','SLEEVE',1,18.03,'1.5.1'),
('1524809510','ADJUSTABLE BOLT',1,12.82,'1.5.2'),
('1530411604','BASE',1,7.27,'1.5.3')
-- Mengupdate
update @BOMStructure
set TotalPrice = 0
where PartNumber in
select PartNumber
from @BOMStructure
-- Mengisi Table Total Price
update @BOMStructure
set TotalPrice = Price * Qty;
-- Mengupdate Sub Assy Dan Main Assy di kalikan dengan qty
WITH cteParents(ItemNumber)
AS (
SELECT ItemNumber
FROM @BOMStructure
WHERE partnumber in (
select e1.PartNumber from @BOMStructure e1,@BOMStructure e2
where e2.ItemNumber > e1 .ItemNumber
and e2.ItemNumber < e1 .ItemNumber + 'Z'
and e1 .ItemNumber not like '1'
and e2 .ItemNumber Not like '1'
group by e1.PartNumber
), cteSource(ItemNumber, TotalPrice)
AS (
SELECT p.ItemNumber,
SUM(COALESCE(s.TotalPrice , 0)) AS TotalPrice
FROM cteParents AS p
LEFT JOIN (
SELECT ItemNumber AS Original,
CASE
WHEN ItemNumber LIKE '%.%' THEN ItemNumber
ELSE '1.' + ItemNumber
END AS ItemNumber,
TotalPrice = Price * Qty
FROM @BOMStructure
) AS s ON s.ItemNumber LIKE p.ItemNumber + '.%'
OR p.ItemNumber = '1'--'0'
WHERE s.Original NOT IN (SELECT ItemNumber FROM cteParents)
GROUP BY p.ItemNumber
UPDATE s
SET s.TotalPrice = q.TotalPrice * s.Qty
FROM @BOMStructure AS s
INNER JOIN cteSource AS q ON q.ItemNumber = s.ItemNumber;
--Mengupdate Harga Main Assy menggunakan function With
with cteLevel(Lvl, PartNumber, TotalPrice)
AS
select LEN (ItemNumber)- LEN(REPLACE(ItemNumber, '.', ''))as Lvl, PartNumber,TotalPrice from @BOMStructure
update s
set s.TotalPrice = (select sum(TotalPrice )from cteLevel as PriceLvl1 where Lvl = 1)
from @BOMStructure as s
INNER JOIN cteLevel AS q ON q.PartNumber = s.PartNumber
where s.ItemNumber = '1'
update @BOMStructure
set Price = TotalPrice / Qty
--Kondisi Part Number yang merupakan Sub Assembly
where PartNumber in (select e1.PartNumber from @BOMStructure e1,@BOMStructure e2
where e2.ItemNumber > e1 .ItemNumber
and e2.ItemNumber < e1 .ItemNumber + 'Z'
and e1 .ItemNumber not like '1'
and e2 .ItemNumber Not like '1'
group by e1.PartNumber )
update @BOMStructure
set Price = TotalPrice / Qty
where ItemNumber = '1'
select PartNumber, Descript , Qty , Price , TotalPrice , ItemNumber
from @BOMStructure
Here's the query with incorrect result where level of depth > 3 level :
--select *from tblBOMStructed
DECLARE @BOMStructure TABLE
PartNumber varchar(14)not null ,
Descript varchar(50)not null,
Qty integer not null default 0,
Price Decimal (10,2) default 0,
TotalPrice Decimal (10,2) default 0,
ItemNumber varchar(14) not null primary key
INSERT @BOMStructure
(PartNumber ,Descript ,Qty ,Price ,ItemNumber)
VALUES ('14300100001029','ATMOSPHERIC TANK',1,0,'1'),
('00150060060005','BASIC TANK',1,0,'1.1'),
('11012142200503','SHELL',1,789.89,'1.1.1'),
('12052140503','TOP CONE',1,226.75,'1.1.2'),
('13052140503','BOTTOM CONE',1,226.75,'1.1.3'),
('140104116508','PIPE LEG',3,39.75,'1.1.4'),
('15004104','BALL FEET',3,0,'1.1.5'),
('1510413504','SLEEVE',1,18.03,'1.1.5.1'),
('1524809510','ADJUSTABLE BOLT',1,12.82,'1.1.5.2'),
('1530411604','BASE',1,7.27,'1.1.5.3')
-- Mengupdate
update @BOMStructure
set TotalPrice = 0
where PartNumber in
select PartNumber
from @BOMStructure
-- Mengisi Table Total Price
update @BOMStructure
set TotalPrice = Price * Qty;
-- Mengupdate Sub Assy Dan Main Assy di kalikan dengan qty
WITH cteParents(ItemNumber)
AS (
SELECT ItemNumber
FROM @BOMStructure
WHERE partnumber in (
select e1.PartNumber from @BOMStructure e1,@BOMStructure e2
where e2.ItemNumber > e1 .ItemNumber
and e2.ItemNumber < e1 .ItemNumber + 'Z'
and e1 .ItemNumber not like '1'
and e2 .ItemNumber Not like '1'
group by e1.PartNumber
), cteSource(ItemNumber, TotalPrice)
AS (
SELECT p.ItemNumber,
SUM(COALESCE(s.TotalPrice , 0)) AS TotalPrice
FROM cteParents AS p
LEFT JOIN (
SELECT ItemNumber AS Original,
CASE
WHEN ItemNumber LIKE '%.%' THEN ItemNumber
ELSE '1.' + ItemNumber
END AS ItemNumber,
TotalPrice = Price * Qty
FROM @BOMStructure
) AS s ON s.ItemNumber LIKE p.ItemNumber + '.%'
OR p.ItemNumber = '1'--'0'
WHERE s.Original NOT IN (SELECT ItemNumber FROM cteParents)
GROUP BY p.ItemNumber
UPDATE s
SET s.TotalPrice = q.TotalPrice * s.Qty
FROM @BOMStructure AS s
INNER JOIN cteSource AS q ON q.ItemNumber = s.ItemNumber;
--Mengupdate Harga Main Assy menggunakan function With
with cteLevel(Lvl, PartNumber, TotalPrice)
AS
select LEN (ItemNumber)- LEN(REPLACE(ItemNumber, '.', ''))as Lvl, PartNumber,TotalPrice from @BOMStructure
update s
set s.TotalPrice = (select sum(TotalPrice )from cteLevel as PriceLvl1 where Lvl = 1)
from @BOMStructure as s
INNER JOIN cteLevel AS q ON q.PartNumber = s.PartNumber
where s.ItemNumber = '1'
update @BOMStructure
set Price = TotalPrice / Qty
--Kondisi Part Number yang merupakan Sub Assembly
where PartNumber in (select e1.PartNumber from @BOMStructure e1,@BOMStructure e2
where e2.ItemNumber > e1 .ItemNumber
and e2.ItemNumber < e1 .ItemNumber + 'Z'
and e1 .ItemNumber not like '1'
and e2 .ItemNumber Not like '1'
group by e1.PartNumber )
update @BOMStructure
set Price = TotalPrice / Qty
where ItemNumber = '1'
select PartNumber, Descript , Qty , Price , TotalPrice , ItemNumber
from @BOMStructure
Could some explain me how to solve this problem.
Regards,
Afri--select *from tblBOMStructed
DECLARE @BOMStructure TABLE (
PartNumber VARCHAR(14) NOT NULL
,Descript VARCHAR(50) NOT NULL
,Qty INTEGER NOT NULL DEFAULT 0
,Price DECIMAL(10, 2) DEFAULT 0
,TotalPrice DECIMAL(10, 2) DEFAULT 0
,ItemNumber VARCHAR(14) NOT NULL PRIMARY KEY
INSERT @BOMStructure (
PartNumber
,Descript
,Qty
,Price
,ItemNumber
VALUES (
'14300100001029'
,'ATMOSPHERIC TANK'
,1
,0
,'1'
INSERT @BOMStructure (
PartNumber
,Descript
,Qty
,Price
,ItemNumber
VALUES (
'00150060060005'
,'BASIC TANK'
,1
,0
,'1.1'
INSERT @BOMStructure (
PartNumber
,Descript
,Qty
,Price
,ItemNumber
VALUES (
'11012142200503'
,'SHELL'
,1
,789.89
,'1.1.1'
INSERT @BOMStructure (
PartNumber
,Descript
,Qty
,Price
,ItemNumber
VALUES (
'12052140503'
,'TOP CONE'
,1
,226.75
,'1.1.2'
INSERT @BOMStructure (
PartNumber
,Descript
,Qty
,Price
,ItemNumber
VALUES (
'13052140503'
,'BOTTOM CONE'
,1
,226.75
,'1.1.3'
INSERT @BOMStructure (
PartNumber
,Descript
,Qty
,Price
,ItemNumber
VALUES (
'140104116508'
,'PIPE LEG'
,3
,39.75
,'1.1.4'
INSERT @BOMStructure (
PartNumber
,Descript
,Qty
,Price
,ItemNumber
VALUES (
'15004104'
,'BALL FEET'
,3
,0
,'1.1.5'
INSERT @BOMStructure (
PartNumber
,Descript
,Qty
,Price
,ItemNumber
VALUES (
'1510413504'
,'SLEEVE'
,1
,18.03
,'1.1.5.1'
INSERT @BOMStructure (
PartNumber
,Descript
,Qty
,Price
,ItemNumber
VALUES (
'1524809510'
,'ADJUSTABLE BOLT'
,1
,12.82
,'1.1.5.2'
INSERT @BOMStructure (
PartNumber
,Descript
,Qty
,Price
,ItemNumber
VALUES (
'1530411604'
,'BASE'
,1
,7.27
,'1.1.5.3'
-- Mengupdate
UPDATE @BOMStructure
SET TotalPrice = 0
WHERE PartNumber IN (
SELECT PartNumber
FROM @BOMStructure
-- Mengisi Table Total Price
UPDATE @BOMStructure
SET TotalPrice = Price * Qty;
-- Mengupdate Sub Assy Dan Main Assy di kalikan dengan qty
WITH cteParents (ItemNumber)
AS (
SELECT ItemNumber
FROM @BOMStructure
WHERE partnumber IN (
SELECT e1.PartNumber
FROM @BOMStructure e1
,@BOMStructure e2
WHERE e2.ItemNumber > e1.ItemNumber
AND e2.ItemNumber < e1.ItemNumber + 'Z'
AND e1.ItemNumber NOT LIKE '1'
AND e2.ItemNumber NOT LIKE '1'
GROUP BY e1.PartNumber
,cteSource (
ItemNumber
,TotalPrice
AS (
SELECT p.ItemNumber
,SUM(COALESCE(s.TotalPrice, 0)) AS TotalPrice
FROM cteParents AS p
LEFT JOIN (
SELECT ItemNumber AS Original
,CASE
WHEN ItemNumber LIKE '%.%'
THEN ItemNumber
ELSE '1.' + ItemNumber
END AS ItemNumber
,TotalPrice = Price * Qty
FROM @BOMStructure
) AS s ON s.ItemNumber LIKE p.ItemNumber + '.%'
OR p.ItemNumber = '1' --'0'
WHERE s.Original NOT IN (
SELECT ItemNumber
FROM cteParents
GROUP BY p.ItemNumber
UPDATE s
SET s.TotalPrice = q.TotalPrice * s.Qty
FROM @BOMStructure AS s
INNER JOIN cteSource AS q ON q.ItemNumber = s.ItemNumber;
--Mengupdate Harga Main Assy menggunakan function With
WITH cteLevel (
Lvl
,PartNumber
,TotalPrice
AS (
SELECT LEN(ItemNumber) - LEN(REPLACE(ItemNumber, '.', '')) AS Lvl
,PartNumber
,TotalPrice
FROM @BOMStructure
UPDATE s
SET s.TotalPrice = (
SELECT sum(TotalPrice)
FROM cteLevel AS PriceLvl1
WHERE Lvl = 1
FROM @BOMStructure AS s
INNER JOIN cteLevel AS q ON q.PartNumber = s.PartNumber
WHERE s.ItemNumber = '1'
UPDATE @BOMStructure
SET Price = TotalPrice / Qty
--Kondisi Part Number yang merupakan Sub Assembly
WHERE PartNumber IN (
SELECT e1.PartNumber
FROM @BOMStructure e1
,@BOMStructure e2
WHERE e2.ItemNumber > e1.ItemNumber
AND e2.ItemNumber < e1.ItemNumber + 'Z'
AND e1.ItemNumber NOT LIKE '1'
AND e2.ItemNumber NOT LIKE '1'
GROUP BY e1.PartNumber
UPDATE @BOMStructure
SET Price = TotalPrice / Qty
WHERE ItemNumber = '1'
SELECT PartNumber
,Descript
,Qty
,Price
,TotalPrice
,ItemNumber
,(LEN(ItemNumber) - LEN(REPLACE(ItemNumber, '.', ''))) as C
FROM @BOMStructure
Can you explain logic behind 1 or 1.1 must 1477.00.
Shridhar J Joshi
Thanks alot -
Query execution HTMLDB is taking much time
I am using this query to generate a report. I am using Meterialized View to select the colums. But the problem is when I am executing this query in Toad it is taking 20 seconds to execute but in HTMLDB is is taking arrount 1 mint 10 secs.
Can any one say why this is happening..
select
Trade_Reference,
Marketing_Client_Name,
TRADE_Calendar_Date,
Global_Client_Name,
Global_Atomic_Client_Name,
ISIN_Code,
SEDOL_Code,
RIC_Code,
Instrument_Name,
Calendar_Date,
Cancel_Caption,
Buy_or_Sell_Caption,
Sales_Office_Name,
Booking_Office_Name,
HSBC_Sector,
sum(Exchange_Rate) Exchange_Rate,
sum(PRICE) Price,
sum(Quantity) Quantity,
sum(Trade_Count) Trade_Count,
sum(Consideration_USD) Consideration_USD,
sum(Soft_Commission_USD) Soft_Commission_USD,
sum(Hard_Comm_Exc_PT_USD) Hard_Comm_Exc_PT_USD,
sum(Hard_Comm_Inc_PT_USD) Hard_Comm_Inc_PT_USD,
sum(Turn_Commission_USD) Turn_Commission_USD,
sum(Other_Commission_USD) Other_Commission_USD,
sum(Total_Comm_Inc_PT_USD) Total_Comm_Inc_PT_USD,
sum(Sales_Credit_Value_USD) Sales_Credit_Value_USD
from MV_TRADE_ENQUIRY
where
TRIM((nvl(Trade_Reference,'%'))) LIKE '%'||TRIM((nvl(:P2_Trade_Reference,'%'))) || '%' AND
TRIM(upper(nvl(MARKETING_CLIENT_NAME,'%'))) LIKE '%'||TRIM(UPPER(nvl(:P2_MARKETING_CLIENT,'%'))) || '%' and
TRIM(upper(nvl(RIC_Code,'%'))) LIKE '%'||TRIM(UPPER(nvl(:P2_RIC,'%'))) || '%' and
TRIM(upper(nvl(SEDOL_Code,'%'))) LIKE '%'||TRIM(UPPER(nvl(:P2_SEDOL,'%'))) || '%' and
TRIM(upper(nvl(ISIN_Code,'%'))) LIKE '%'||TRIM(UPPER(nvl(:P2_ISIN,'%'))) || '%' and
TRIM(upper(nvl(GLOBAL_CLIENT_NAME,'%'))) LIKE '%'||TRIM(UPPER(nvl(:P2_GLOBAL_CLIENT,'%'))) || '%' and
TRIM(upper(nvl(GLOBAL_ATOMIC_CLIENT_NAME,'%'))) LIKE '%'||TRIM(UPPER(nvl(:P2_GLOBAL_ATOMIC_CLIENT,'%'))) || '%' and
TRIM(upper(nvl(INSTRUMENT_NAME,'%'))) LIKE '%'||TRIM(UPPER(nvl(:P2_INSTRUMENT_NAME,'%'))) || '%' and
TRIM(upper(nvl(HSBC_SECTOR,'%'))) LIKE '%'||TRIM(UPPER(nvl(:P2_HSBC_SECTOR,'%'))) || '%' and
BOOKING_OFFICE_SKEY||'' = decode(:P2_BOOKING_OFFICE,'0',BOOKING_OFFICE_SKEY,to_number(:P2_BOOKING_OFFICE)) and
SALES_OFFICE_SKEY||'' = decode(:P2_SALES_OFFICE,'0',SALES_OFFICE_SKEY,to_number(:P2_SALES_OFFICE)) and
TRIM(upper(nvl(BUY_OR_SELL_CAPTION,'%'))) LIKE '%'||TRIM(UPPER(nvl(:P2_BUY_SELL,'%'))) || '%' and
TRIM(upper(nvl(CANCEL_CAPTION,'%'))) LIKE '%'||TRIM(UPPER(nvl(:P2_INCLUDE_CANCELLED_TRADES,'%'))) || '%' and
Trade_Calendar_Date between
nvl(to_date(:P2_Trade_DATE_FROM,'DD-MON-RRRR'),to_date(sysdate -90,'DD-MON-RRRR'))
and nvl(to_date(:P2_Trade_DATE_TO,'DD-MON-RRRR'),to_date(sysdate,'DD-MON-RRRR'))
and Calendar_Date between
nvl(to_date(:P2_Booking_DATE_FROM,'DD-MON-RRRR'),to_date(sysdate-90,'DD-MON-RRRR'))
and nvl(to_date(:P2_Booking_DATE_TO,'DD-MON-RRRR'),to_date(sysdate,'DD-MON-RRRR'))
group by
Trade_Reference,
Marketing_Client_Name,
TRADE_Calendar_Date,
Global_Client_Name,
Global_Atomic_Client_Name,
ISIN_Code,
SEDOL_Code,
RIC_Code,
Instrument_Name,
Calendar_Date,
Cancel_Caption,
Buy_or_Sell_Caption,
Sales_Office_Name,
Booking_Office_Name,
HSBC_Sector;Dikshit,
Firstly don't believe the timings in TOAD, it's quite likely that it's only bringing the first results rather than doing all the work upfront (you can check this by scrolling to the end of the results grid and seeing how long it takes).
Secondly without a textual description of what you want that query to do it's pretty difficult to suggest "better" ways of doing it. I'd say that you should try generating a tracefile for your query that we can look through.
Take a look at the TracingPerformanceProblems section on the Wiki -
http://wiki.shellprompt.net/bin/view/HTMLDB/QuickTipsCategory -
Good morning,
Obviously, I simply do not understand the query that gets constructed to create a Tree structure in APEX. I have a Tree in Oracle Forms that works correctly. I cannot, however, seem to get it to port over to APEX.
In my table (a table of contents type of structure), I have 3 columns that govern where in the list an item falls. TOC_LEVEL (1 a parent-level entry, or 2 child-level entry), TOC_PARENT, what parent a child entry is associated with, and TOC_SEQ_ID, where in the list an item should be placed.
So, I might have entries like this:
TOC_LEVEL TOC_PARENT TOC_SEQ_ID
1 NULL 1
2 1 50
2 1 60
1 2 2
1 3 3
2 3 50 - dups here don't matter because it would fall under a different parent...
2 3 75
and so-on.
The query that I use in my Form is this:
select decode(level,-1,-1,-1),
level,
toc_description,
toc_entry_type,
toc_id
from toc where state_id = '&State_ID'
start with toc_level = 1
connect by prior toc_seq_id = TOC_Parent
and prior State_ID = '&State_ID'
order by to_char(toc_parent) || to_char(toc_seq_id)
and this works. I am able to display and retrieve the appropriate data.
I can NOT seem to get this or any variation to work within APEX.
The closest I have come is that I retrieve all of the parent-level entries, but retrieve the very same child-entries under each parent. And when I click the '+' on one parent, ALL parents expand... and the '-' colapses all parents, not just the one I clicked.
What is it that I am missing here?
Thanks,
DonHi Don,
The value for the hidden Pn_TREE_ROOT should be the id of the topmost item in your tree. If you have more than one that could be topmost, then you have to create a dummy root - this was described in the linked thread - and the ID of the dummy root should be used.
So, in your example, if more than one toc_parent entry can contain null, you have more than one root so must create a dummy root. If only one toc_parent entry contains null, then the ID of this record must be specified as the root.
The only thing you may have to do from the linked example, would be to convert the nulls for your actual pid values into 1 to get them to link to the new dummy parent.
So:
select 1 id, null pid, 'Rootname' name, null link, null a1, null a2 from link
union all
select
toc_level+1000000 id,
case when toc_parent is null then 1 else toc_parent+1000000 end pid,
toc_description name,
null link,
null a1,
null a2
from toc where state_id = 'ZZ';This creates a dummy root with an id of 1 and attaches all of your actual parents to this root. The actual ID values have to be increased to ensure that none of them could be a 1 and become attached to the root.
Andy -
Hi,
Any ideas or code samples of how we could use the XML SQL Utility
to do a tree structure, like the following:
<GROUP id="grp1">
<ITEM> item 1 </ITEM>
<ITEM> item 2 </ITEM>
<GROUP id="grp2">
<ITEM> item 3 </ITEM>
<ITEM> item 4 </ITEM>
</GROUP>
<ITEM> item 5 </ITEM>
</GROUP>
Thanks,
Cyril.
nullHi Mark,
To a certain extent one can modify the xml generated by
manipulating the query and by using some of the tag name
customizations which the XSU allows. Unfortunately, what you
want to create will take more than that; you will have to use
XSLT - xml transformation language, part of XSL. You will find
and XSL processor packaged with the oracle xml parser v2 (see
oraxsl). You can find more info on XSLT at www.w3c.org
Mark Fortner (guest) wrote:
: I have an example similar to his:
: Given a resultset in the form:
: Company Department User
: Oracle XML Dev John Smith
: Oracle XML Dev Jane Smith
: Oracle Mgmt Larry Ellison
: Sun Project X Jane Doe
: Sun Mgmt Scott McNealy
: which usually results in XML like this
: <rowset>
: <row id=1>
: <Company>Oracle</Company>
: <Department>XML Dev</Department>
: <User>John Smith</User>
: </row>
: </rowset>
: how do I get it to look like this?
: <JTree>
: <Oracle>
: <XML Dev>
: <Jane Smith/>
: <John Smith/>
: </XML Dev>
: <Mgmt>
: <Larry Ellison/>
: </Mgmt>
: </Oracle>
: <Sun>
: <Project X>
: <Jane Doe/>
: </Project X>
: <Mgmt>
: <Scott McNealy/>
: </Mgmt>
: </Sun>
: </JTree>
: Oracle XML Team wrote:
: : Hi Cyril,
: : Your question is a bit vague. Do you have a table which
you
: : are trying to query and get the result in the following
: format?
: : If these is the case please give me the description of the
: table
: : or the view.
: : The other thing to keep in mind is that even if the XSU
: can't
: : give you the XML data in the exactly the format you want, you
: can
: : always use XSLT to transform the XML doc generated by the XSU
: to
: : the desired XML doc.
: : Cyril Dunnion (guest) wrote:
: : : Hi,
: : : Any ideas or code samples of how we could use the XML SQL
: : Utility
: : : to do a tree structure, like the following:
: : : <GROUP id="grp1">
: : : <ITEM> item 1 </ITEM>
: : : <ITEM> item 2 </ITEM>
: : : <GROUP id="grp2">
: : : <ITEM> item 3 </ITEM>
: : : <ITEM> item 4 </ITEM>
: : : </GROUP>
: : : <ITEM> item 5 </ITEM>
: : : </GROUP>
: : : Thanks,
: : : Cyril.
: : Oracle Technology Network
: : http://technet.oracle.com
Oracle Technology Network
http://technet.oracle.com
null -
Creating a tree query on multiple tables
I have been reading the following article:
http://www.oracle.com/technology/oramag/webcolumns/2003/techarticles/gennick_connectby.html#f1
The diagram 1b that the above links to shows a local government hierrachy structure stored in multiple tables. I am having a little difficulty understanding how you would write a query (using start with connect by syntax) to get the data displayed in a tree format??
ie: (spaces are being removed so replaced them with --)
state1
--county1
--county2
----township1
----township2
--county3
state2
state3
--county3
--county4hi, please post a sample data it would help us to further analyze. thanks.
here is some example that might help
NODE_DATA NODE_PAREN
CAR TRANSPORT
PLANE TRANSPORT
BIKE TRANSPORT
TRANSPORT
HONDA CAR
747-400 PLANE
MAZDA CAR
FOOD
FRUIT FOOD
VEGETABLE FOOD
SPINACH VEGETABLE
CARROT VEGETABLE
12 rows selected.
SQL> select substr(rpad(' ',decode(level,1,0,2,2,4),' ')||node_data,1,20) node_data
2 from myTreeData
3 start with node_parent is null
4 connect by node_parent = prior node_data;
NODE_DATA
TRANSPORT
CAR
HONDA
MAZDA
PLANE
747-400
BIKE
FOOD
FRUIT
VEGETABLE
SPINACH
CARROT
12 rows selected.
SQL> -
Why tree query can't take where clause
I build a tree struncture without where clause , it is fine, but When I tried to add a where clause, I get error, (Warning: Tree root ID "1" not found. ). Does anybody know why?
Here is my SQL
select "ID" id,
"PID" pid,
"NAME" name,
"LINK" link
from CAPACITY_TREE
where branch='CAP'
order by 3Hi,
I'm having a similar problem in APEX 3.01. If you try to create a try using the following query you get the: Warning: Tree root ID "7839" not found error, where 7839 is the "KING" id empno
WITH x AS
(SELECT "EMPNO" ID,
"MGR" pid,
"ENAME" NAME,
NULL LINK,
NULL a1,
NULL a2
FROM "EMP"
where ename = 'JONES')
SELECT x.id, x.pid, x.name, x.link, x.a1, x.a2
FROM xAny ideas as to why we can't put a where clause in a tree? -
Hi All,
I want to execute seperately a report which is displayed in report tree,
the program name it shows is something like FBRX01GLPCTSFINSTAT-FA-X.
What does this name signifies ?
Thanks.Report Tree:
An ABAP reporting tree program that allows the user to press enter or double click on any line. The report is updated with new internal table data and re-written. The cursor and paging returns to the exact same line the user was on, even though the report was re-written from the internal table. Input fields are filled with data based on ENTER of DOUBLE CLICK. [+] and [-] is displayed on each line and changes if user selects to expand/collapse.
Here, you specify the name of the tree to be used for report selection in the application menu. SAP supplies one default tree per application, but customers can create their own trees and overwrite the SAP tree.
Under Extras -> Control, you can define whether the reports in the tree are to be displayed in a selection window or on a separate screen. To suppress the processing of report trees for the relevant application by choosing Inactive . When you call report selection in the application menu, the list selected in the report list is then displayed.
It is also possible to deactivate the report tree for any end-user in any application by setting the user parameter 'KBT' to 'X'.
Transporting the Tree Sructure
When you change a tree, it is included in a transport request (transport object R3TR SRTR). The following are then transported:
The tree structure all the texts
Node entries (the names of the reports and variants)
The following are not automatically transported:
User-specific settings (initial position, sub.trees, visible entries)
Saved lists
When you change a node, it is also included in a transport request. The following are then transported:
Node entries (the names of the reports and variants)
Manual Transport (for Special Cases)
The tree structure is stored in the table SERPTREE. A tree structure can only be transported as a whole, and the transport request should contain the following entry:
R3TR TABU SERPTREE and SERPT. Function R transports all trees from the source system and overwrites those in the target system.
R3TR TABU SERPTREE und SERPT. Function K transports only those trees specified on the next screen. You must enter function R. You can only specify the tree ID; the node ID must be specified generically.
If you want to overwrite a tree structure in the target system, the node contents (table SREPOVARI, see below) and the user-specific views (table SERPENTR and SREPOUSER, see below) should also be transported, or at least deleted in the target system.
Transporting Node Contents
The contents of report tree nodes (reports and variants) are stored in the table SREPOVARI. In this case, you should make the following entry in the transport request:
R3TR TABU SREPOVARI. Function R transports the contents of all nodes of all trees from the source system and overwrites those in the target system.
R3TR TABU SREPOVARI. Function K transports only the node contents specified in the next screen. You enter function R here.
If you want to overwrite a node in the target system, the user-specific views (table SREPOUSER, see below) should also be transported, or at least deleted in the target system.
Transporting User-Specific Views
The views of the report tree are stored in the table SERPENTR. You must make the following entry in the transport request:
R3TR TABU SERPENTR. Function R transports the views of all users of all trees from the source system and overwrites those in the target system.
R3TR TABU SERPENTR. Function K transports only those views specified on the next screen. You enter function R here.
The views of the nodes are stored in the table SREPOUSER. You must make the following entry in the transport request:
R3TR TABU SREPOUSER. Function R transports the view of all users of all nodes from the source system and overwrites those in the target system.
R3TR TABU SREPOUSER. Function K transports only those views specified on the next screen. You enter function R here.
Delete country-specific reports from report tree
Example
Deleting country-specific personnel reports from the report tree, for example, deleting the reports for USA.
Further notes
Selection criteria on the selection screen:
Reports to be deleted: Specify the report name (optional)
Report tree: for example, SAP1 for the tree displayed when you choose Information systems -> Gen.report selection.
Delete also in user trees: Default = checkbox selected.
Change database: Test mode = Checkbox not selected, i.e. no database updates.
When you execute the report, you get a list of all countries for which country-specific reports can be deleted. You then select the countries for which you want to delete reports.
To delete single reports, choose Country-spec. report. To delete all country-specific reports for the countries selected, choose Delete tree area.
When you choose Delete tree area, you are prompted to confirm the deletion. The selected reports are then deleted and the system displays a log of the deleted reports (also in test mode).
Working with Reports in the Report Tree
Prerequisites
Once you have accessed General Report Selection, you can expand the report tree structure to find the reports you want to start and perform other related functions:
You can:
Start reports
Start reports in the background
Find reports
Display report attributes
Display report variants
Display report documentation
Access and start reports that do not appear in the report tree
Procedure
Starting Reports
1. Expand the report tree structure until you reach the required report
2. Position the cursor on the report and choose Execute (or double-click on the report)
If the report has no selection screen, the resulting list is displayed immediately.
If the report has a selection screen, go to step 3.
3. Enter your selection criteria and choose Execute
For an example of how to start a report in General Report Selection, see:
Starting a Report in the Report Tree: Example
Starting Reports in the Background
Only reports, for which variants exist, can be started in the background. You must also schedule a background job.
To start a report in the background:
1. Expand the report tree structure until you reach the required report
2. Position the cursor on the report and choose Execute in background
For more information about working with variants and scheduling background jobs, see:
Variants
Background Processing
Searching For Reports
To find a particular report in the report tree structure:
1. Choose Edit  Find  Objects
2. Enter your search criteria
You can enter basic search criteria and, for ABAP reports only, additional search criteria.
Basic Search Criteria
Search criterion Remarks
Report name This is the technical name of the report (for ABAP report, Report Writer reports, and transactions), or the user group for queries.
Extended report name This is the technical name of the report (for drilldown reports or report portfolio reports), or the query name for queries.
Title This is the report title. Here, the system searches for a title that matches the user's entry exactly.
Node This is the technical name of a node in the report tree.
You can specify additional selection criteria for ABAP reports as specified in the program attributes:
Additional Search Criteria
Search criterion
Application
Logical database
Created by
Last changed by
To determine the area in which you want to search for a report, check the appropriate boxes as follows:
Restrict Search Area
Restrict to Action
Whole report tree Enter the technical name of the root node and select Find in subordinate nodes.
Sub-tree Enter the technical name of the sub-tree node and select Find in subordinate nodes.
Node Enter the technical name of the node and select Find in subordinate nodes.
You can search for a report using one or more character strings that appear in the report documentation, but this is very time-intensive.
You can also perform generic searches using *.
3. Choose Execute
The list of results is sorted by node.
Displaying Report Attributes
To display the attributes of a report in the report tree structure:
1. Position the cursor on the relevant report
2. Choose Edit  Node attributes
You see the following information (if present):
 Report type
 Technical name of the underlying executable program
 Extended report name
 Report variant
Checkboxes also indicate whether:
 The report is started using a variant
 The selection screen of the report is skipped
Displaying Report Variants
If a report has variants, these are listed as subordinate nodes. You can start variants just like any other reports.
To display the variants of a report in a different way:
1. Position the cursor on the relevant report
2. Choose Goto  Variants
3. Ensure that the Variants field is left blank and get a list of possible entries
4. Choose Display
You see a list of variants defined for the report.
If you want to start a report in the background, you must create a variant first.
For more information about working with variants, see:
Variants
Displaying Report Documentation
To display detailed documentation about a report:
1. Position the cursor on the relevant report
2. Choose Goto  Documentation
Starting Reports not in the Report Tree
If the report you want to start is not in the report tree, and you cannot access it through other menus, you can start it by running the underlying executable program. To do this, you need to know the program name:
1. Choose Goto  General reporting
2. Enter the program name
3. Choose Execute
For further information about working with reports, see:
Reports
Starting a Report in the Report Tree: Example
To get a list of the remaining leave entitlement of various employees:
1. On the General Report Selection screen, expand the tree structure by choosing Human Resources  Time management  Absence
2. Place the cursor on the Leave Overview report and choose Execute (or double-click the report)
3. Enter your selection criteria and execute the report
The system displays the results on the screen.
Report Variants
Definition
Group of selection criteria that has been saved. A report can have several different variants, with each variant retrieving different types of information. For example, a vendor report might have one variant for U.S. vendors and another variant for European vendors.
Use
Instead of entering the same values in the selection criteria input fields each time you execute a report, you can enter the values once and then save the selection criteria as a variant. The next time you execute the report, you only need to enter the variant name, not the selection criteria. If you use variants, the selection criteria screen is already filled with data.
To execute certain reports, you must use a variant. In this case, a system message prompts you to do so. Although you are not always required to use variants or selection criteria, it is a good idea to use them when possible. Your resulting lists will be smaller and take less time for the system to process.
Background Processing
Use
In background processing, the SAP System automatically runs any report or program that you can start interactively.
When you schedule a job in the background processing system, you must specify:
The ABAP report or external program that should be started
The start time
The printing specifications
The background processing system starts your job and runs the program(s) that you specify. Afterwards, you can check whether your job was executed successfully and display a log of any system messages.
Suppose you need to run a report of customers whose bills are overdue.You can:
o Start the report yourself from the ABAP Editor. If you do this, the system runs the report interactively, in a session at your PC or workstation. While the report is being processed, your computer response time may be slower.
o Or, you can have the background processing system run the report. To do this, you must create a background job that tells the system what you want it to do.
The background processing system runs your "late bills" report according to your instructions. The list generated by the report is either printed directly or is waiting for you in the SAP output controller (see Using the Output Controller).You can also check in the background processing system whether the report ran correctly.
Features
Running a report in the background does not tie up the SAP sessions you are currently working with.
When you start a report interactively, your current SAP session is blocked for further input for as long as the report runs.
When you start the report in the background, running the report does not influence your interactive work with the SAP System.
You can shift the execution of reports to the evening or other periods of low load on the SAP System.
You can schedule a report or external program to run at any time that the SAP System is active. You can also set up reports to run automatically on a regular basis (for example, on the last day of each month).
Background processing is the only way you can execute long-running jobs.
To prevent tying up system resources with interactive sessions for long reports, the SAP System has a built-in time limit on interactive sessions. If a single ABAP report runs for more than 5 minutes continuously in an interactive session, the SAP System terminates the report automatically.
The background processing system executes long-running ABAP reports more efficiently. Often, such reports are automatically scheduled for execution in the background. In this case, you do not need to schedule them for background processing yourself.
Reports
Use
When you are working in the SAP System, you may want to access information from the database. To do this, you use reports.
In this documentation, report refers to the report program, and list refers to the output that is, the results of the report.
Some reports display information; others allow you to perform analyses.
A report must be started, or executed. In many cases, the SAP System automatically executes a report. Sometimes, however, you will want to execute a report yourself.
In addition to report programs, the SAP System provides numerous reporting tools, each of which has its own set of procedures for executing report programs.
This documentation describes report programs only. For an introduction to the SAP reporting tools, refer to the Reporting Made Easy guidebooks (Release 4.0B). You can find these guidebooks at: www.saplabs.com/rme .
<b>Kindly reward this if found useful</b> -
All i have the following code and it works using my SQLplus editor but htmldb will not accept it.
break on report
compute sum LABEL 'TOTAL' of MARKET on report
compute sum of 'E' on report
compute sum of 'G' on report
compute sum of TOTAL on report
select trader,
max( decode( MARKET, 'E', cnt, 0 ) )"E",
max( decode( MARKET, 'G', cnt, null ) )"G",
max( decode( MARKET, 'E', cnt, 0 ) ) +
max( decode( MARKET, 'G', cnt, 0 ) ) +
max( decode( MARKET, 'G', cnt, 0 ) ) TOTAL
from (
SELECT A1.trader, A2.MARKET, SUM(A2.VOLUME) cnt
FROM table2 A1, table1 A2
where A1.trader = A2.GIMSG
and A1.APPLICATION = 'appname'
and A2.MARKET != '-'
and A2.MARKET != 'DBFX'
and trunc(A2.TRADEDATE,'MONTH') = '01-JAN-06'
and A2.ACTION = 'A'
and A2.BAF_INDICATOR != 'B'
group by A1.trader, A2.MARKET
group by traderIs this something that is not supported ?I see that you can do sum for each colum, but what if i wanted the sum for all colums so if i had the following table
TRADER E G TOTAL
test1 23557 5500 36147
test2 10656 25756 41412
test3 0 0
test4 200 200
test5 4223 4223
test6 1750 1750So when i mean sum i mean IE the sum of all trader for E
So i would get the following
trader E G Total
test 1 2 3
test1 2 2 4
Sum 3 4 7 -
dear all,
plz can you explain to me what is this query mean
plz i need it piece by piece
rg_emps := Create_Group_From_Query('rg_emps','select 1, level,last_name, NULL, to_char(employee_id) '||' from employees ' ||'connect by prior employee_id = manager_id ' ||'start with job_id = ''AD_PRES''');i exactly need this part
select 1, level, last_name, null
how could you select null (oooooooh )
plz help & advicehi
here is an example:
select -1 , level , ename , null , to_char(empno)
from emp start with mgr is null
connect by prior empno = mgror
select 1 , level , ename , null , to_char(empno)
from emp start with mgr is null
connect by prior empno = mgrsarah
Edited by: QGIRCO on Jan 17, 2010 10:27 PM -
Spanning tree query for extending existing lan
Hi Guys,
I've got a network setup where I need to add a new set of switches have some new vlans that are independant to the existing environment but i have some of the existing vlans propogate accross.
My current setup is:
and my new design is this:
The 5505-02 is there so that i can easily manage acl's so that only some users can access the new vlans such as 200. And in the future put in idfw to manage this via AD groups.
My concern is regarding spanning tree. The current set up the 3750-01 , 2960-01, sf300-01 and sf300-02 are all set to default pvst where the 3750-01 is the root bridge for all existing vlans
With having the vlan 101 and 102 being propagated across to the new environment what is the best way of tackling STP for this? could I manually set the root primary and the priority to be lowest for these two vlans as the 3750-01? And then the same for the new 200 and 201 as the new 3750-02?
Or would setting a different mode be best i.e mst?
thanks
RichRich
Are you proposing to use the same IP subnet for vlans 101 and 102 on the new switches ?
If so unless the ASA 5505-02 is in transparent mode then you will not be able to extend vlans 101 and 102 across to the new switches ie. if it is in routed mode that is a L3 hop and you generally can't extend a L2 vlan across a L3 hop. There are technologies that allow you to do this but i dont think any of them are supported on the 3750 switches.
If you are making the ASA 5505-02 transparent then it would need to be transparent for a trunk link and i don;t know whether this is possible. You may want to ask in the firewalling forums.
So before worrying about STP can you clarify what you are going to be doing with ASA 5505-02 and that whether or not you are proposing to use the same IP subnet for those vlans on the new switches ?
One last question. Any particular reason why you are using a square topology as opposed to simply using multiple uplinks from each 2960 to the 3750 stack ?
Jon -
Multiple CHECKBOX Using Select Query in htmldb.item API
Hi,
I have a requirement where I need to create a Record using HTMLDB_APPLICATION.CHECKBOX ..but having multiple values(around 8) using the Select statement.
I tried the STATIC thing, but it shows only 2 values.
Is this possible ?
How ?
Thanks
Sandeephey sandeep--
i'm not sure at all what you're asking here. if this is still an issue for you, please restate it much more clearly.
thanks,
raj
ps-there is no htmldb_application.checkbox. -
Hi all,
I have two regions on my page. One is a tree region, and the other one is report region.
What i would like to do is when I click on a node, to get some info about it in an item on the report region.
my tree query looks like that:
select "ID" id,
"REL" pid,
"NAME" name,
null link,
null a1,
null a2
from "#OWNER#"."MY_VIEW"
order by 3
Can anybody help me?
Thanks in advance
Tsveti:)Tsveti,
do the following:
1) have a hidden item defined in report region ( say p1_rpt_id )
2) in report region, include p1_rpt_id in where clause accordingly
3) ur tree query will look like
select "ID" id,
"REL" pid,
"NAME" name,
'f?p=&app_id.:&app_page_id.:&session.:::p1_rpt_id:' || #your_value_forwhich_you_want_info# || ':' link,
null a1,
null a2
from "#OWNER#"."MY_VIEW"
order by 3
this should work. give it a try..
SUNDARK -
How to not display nodes in a tree if Oracle roles are NOT used?
How to not display nodes in a tree if Oracle roles are NOT used?
We don't use Oracle DB roles to grant users access to Forms from the menu. We use a template and role system of our own. Basically a few tables with templates and roles.
We want to convert our normal Forms menu to a tree menu and one of our key requirements is that when the tree is populated ONLY nodes with programs (i.e. forms) he has been granted to execute is shown.
Since we don't use Oracle Roles how to do this in a tree?
I created a function to show/hide LEAF nodes, BUT problem is that there are sub-menu nodes showing even if the leaf-nodes under it has not being displayed. My function has suppressed it.
My tree query is like this:
SELECT
t.status, LEVEL, t.label, t.icon, t.node VALUE
FROM
tma_tree_menu t
WHERE
tma_authenticate_sys_chk_role(USER, t.node) = 1
CONNECT BY
PRIOR t.node = t.master
START WITH
t.MASTER IS NULL
ORDER SIBLINGS BY
t.position
The tma_authenticate_sys_chk_role will return 1 only if the user has access to the form under that node.
I tried the FTree functions in Forms but even that has nothing.
Any help would be greatly appreciated.
Edited by: Channa on Mar 17, 2010 6:49 AMWould you share the source code? I guess what I need is how exactly you retreive the user credentials from the DB table and set that boolean variable.
and then how to condition it in UIX?
Maybe you are looking for
-
I tried to set up my daughters iPod touch yesterday on my mother's computer. I used an iTunes card and set up an iTunes account and it said it was approved however none of the app boxes ever showed up on the iPod. The only thing that shows up is a co
-
Yesterday my Firefox icon disappeared from my menu bar. I went into my applications and opened it. Every time I use it to reach gmail, I get a message that I'm using an out of date version and to download a new one. I download it. An installation dis
-
Issues with Flex3 and CF8 on Windows Vista
Sorry for the whine, however I feel it necessary to get a few issues I've found with Flex3 on a Vista Laptop working with CF8 that I've not seen documented elsewhere. Environment: Sony Laptop with Intel Core 2 Duo processor and 3 GB Ram. Running CF 8
-
Cropping offset with artboard "fit to selected art" ?
I have been having this problem for a while now, and did a lot of searching and don't seem to see anyone else having this issue! If I create something in illustrator (in this case, it's a button for a web page), and I create a new artboard and select
-
DOTTED LINE in QT Player playbar... WHAT IS IT?
What does the fine dotted pattern in the QuickTime Player playbar indicate? Some movies display this, but some don't. [url=http://www.victrolux.com/images/nav/pageelements/page/posts/appleforums/QTfinedottedline.jpg" target="_blank"]• PLEASE CLICK HE