Hierarchical and summary 2
Hi
In the last week I post a thread about SUM hierarchical ( sum in levels in the tree )
Re: hierarchical and summary and division : Query Challenge 2
With help , I got to do , but the cost is very high, I explain again what I must to do
I have a table (GRUPO_RELACAO) that save information about parent and child, but in this relation
each group can to be different sectors, when I must to sum a Sector I can not to sum groups of other
sector. look example below with respective values
1[3]
/ \ nm_ciclo_fim is not null then 4 do not have parent
2[1] 4[1]
5[3] 6[4] 8[2] 7[2]
|
|
11[6]
9[5] 12[0]
13[8] 16[4] 1,2,4,5,6,7,8,9 are in SECTOR 16
11,12,13,16 are in SECTOR 18
In structure of table (GRUPO_RELACAO) there is a column NM_CICLO_FIM that must to be NULL
if is not null, then Child is not more relation with parent , in Example 4 was child of 1, but The
column is filled
In example below , to show only SECTOR 16
GROUP SUM LEVEL SECTOR
1 1 1 16 TEAM OF GROUP 1 ONLY 1 (GROUP 2) because group 4 is not child
1 12 2 16 NET (GROUPS 5 AND 6 AND 9 , but no 11 because 11 is sector 18)
1 16 3 16 NETWORK (GROUPS 1,2,5,6,9) = 3+1+3+4+5 = 16
2 7 1 16 TEAM OF GROUP 2
2 5 2 16 NET OF GROUP 2
2 8 3 16 NETWORK OF GROUP 2
3 0 1 16 IS NOT IN TREE BUT IS IN T_ESTRUTURA_COMERCIAL
3 0 2 16 IDEM ABOVE
3 0 3 16 IDEM ABOVE
4 3 1 16 TEAM OF GROUP 4
4 0 2 16 NET OF GROUP 4
4 4 3 16 NETWORK OF GROUP 4
5 0 1 16 TEAM OF GROUP 5 (11 IS SECTOR 18) NO SUM
5 5 2 16 NET OF GROUP 5 (9 IS SECTOR 16 ) SUM
5 3 3 16 NETWORK OF GROUP 5 (5 + 3 ) SELF VALUE
6 0 1 16
6 0 2 16
6 4 3 16
7 0 1 16
7 0 2 16
7 1 3 16
8 0 1 16
8 0 2 16
8 2 3 16
9 0 1 16
9 0 2 16
9 5 3 16
165 0 1 16 Others groups that are not in tree must to show too
165 0 2 16 in example only group 16
165 0 3 16
193 0 1 16
193 0 2 16
193 0 3 16
194 0 1 16
194 0 2 16
194 0 3 16
705 0 1 16
705 0 2 16
705 0 3 16
706 0 1 16
706 0 2 16
706 0 3 16
714 0 1 16
714 0 2 16
714 0 3 16
715 0 1 16
715 0 2 16
715 0 3 16
803 0 1 16
803 0 2 16
803 0 3 16
804 0 1 16
804 0 2 16
804 0 3 16
805 0 1 16
805 0 2 16
805 0 3 16
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
Connected as PROCSCNOB
SQL>
SQL> SELECT T1.CD_EC_MADRINHA,
2 T1.CD_EC_AFILHADA,
3 ID_TIPO_RELACAO,
4 NM_CICLO_FIM
5 FROM SISSCNOB.GRUPO_RELACAO T1
6 ORDER BY 1;
CD_EC_MADRINHA CD_EC_AFILHADA ID_TIPO_RELACAO NM_CICLO_FIM
1 2 1
1 4 1 200802
2 5 1
2 6 1
4 7 1
4 8 1
5 11 1
11 9 1
11 12 1
12 13 1
12 16 1
11 rows selected
SQL> SELECT T2.CD_ESTRUTURA_COMERCIAL, T2.CD_SETOR, T2.ID_ESTRUTURA_ATIVA
2 FROM T_ESTRUTURA_COMERCIAL T2
3 WHERE T2.CD_TIPO_ESTRUTURA_COMERCIAL = 5
4 AND T2.CD_ESTRUTURA_COMERCIAL IN (1,2,3,4,5,6,7,8,9,11,12,13,16);
CD_ESTRUTURA_COMERCIAL CD_SETOR ID_ESTRUTURA_ATIVA
1 16 1
2 16 1
3 16 0
4 16 1
5 16 1
6 16 1
7 16 1
8 16 1
9 16 1
11 18 1
12 18 1
13 18 1
16 18 1
13 rows selected
SQL> SELECT T3.CD_ESTRUTURA_COMERCIAL,
2 T3.NM_CICLO_OPERACIONAL,
3 T3.CD_INDICADOR,
4 T3.VL_INDICADOR
5 FROM T_EC_SETOR_PERFIL_CICLO T3
6 WHERE T3.CD_TIPO_ESTRUTURA_COMERCIAL = 5
7 AND T3.CD_ESTRUTURA_COMERCIAL IN (1,2,3,4,5,6,7,8,9,11,12,13,16)
8 AND T3.NM_CICLO_OPERACIONAL = 200712
9 AND T3.CD_PERFIL = 1
10 AND T3.CD_INDICADOR = 63;
CD_ESTRUTURA_COMERCIAL NM_CICLO_OPERACIONAL CD_INDICADOR VL_INDICADOR
1 200712 63 3.00
2 200712 63 1.00
4 200712 63 1.00
5 200712 63 3.00
6 200712 63 4.00
7 200712 63 1.00
8 200712 63 2.00
9 200712 63 5.00
11 200712 63 6.00
13 200712 63 8.00
16 200712 63 4.00
11 rows selected
THE TABLES
-- In this table ID_TIPO_RELACAO must to be 1 and NM_CICLO_FIM IS NULL
--- When NM_CICLO_FIM not is null the relation between cd_ec_madrinha and cd_ec_afilhada is break
WITH GRUPO_RELACAO AS(
select 1 CD_EC_MADRINHA,
2 CD_EC_AFILHADA,
1 ID_TIPO_RELACAO ,
TO_NUMBER(NULL,0) NM_CICLO_FIM FROM DUAL UNION
SELECT 1,4,1,200802 FROM DUAL UNION
SELECT 2,5,1,TO_NUMBER(NULL,0) FROM DUAL UNION
SELECT 2,6,1,TO_NUMBER(NULL,0) FROM DUAL UNION
SELECT 4,7,1,TO_NUMBER(NULL,0) FROM DUAL UNION
SELECT 4,8,1,TO_NUMBER(NULL,0) FROM DUAL UNION
SELECT 5,11,1,TO_NUMBER(NULL,0) FROM DUAL UNION
SELECT 11,9,1,TO_NUMBER(NULL,0) FROM DUAL UNION
SELECT 11,12,1,TO_NUMBER(NULL,0) FROM DUAL UNION
SELECT 12,13,1,TO_NUMBER(NULL,0) FROM DUAL UNION
SELECT 12,16,1,TO_NUMBER(NULL,0) FROM DUAL )
--- Here table master all CD_EC_MADRINHA and CD_EC_AFILHADA from GRUPO_RELACAO
--- is in this table , There is data here that are not in table GRUPO_RELACAO
---- in JOIN with GRUPO_RELACAO, the column ID_ESTRUTURA_ATIVA must to be 1
----- When to sum a SECTOR it must to sum only values of the SECTOR
--- I can to have Group of a sector that is parent of the other group
--- In example I showed Group 5(group 16) is parent of the group 11 (sector 18)
-- that is parent of the group 9 (group 16)
WITH T_ESTRUTURA_COMERCIAL AS(
select 1 CD_ESTRUTURA_COMERCIAL, 16 CD_SECTOR,1 ID_ESTRUTURA_ATIVA FROM DUAL union
select 2, 16,1 FROM DUAL UNION
select 3,16,0 FROM DUAL UNION
select 4,16,1 FROM DUAL UNION
select 5,16,1 FROM DUAL UNION
select 6,16,1 FROM DUAL UNION
select 7,16,1 FROM DUAL UNION
select 8,16,1 FROM DUAL UNION
select 9,16,1 FROM DUAL UNION
select 11,18,1 FROM DUAL UNION
select 12,18,1 FROM DUAL UNION
select 13,18,1 FROM DUAL UNION
select 16,18,1 FROM DUAL )
SELECT * FROM T_ESTRUTURA_COMERCIAL
-- The 3rd and last table
-----this Table have the values that I must to sum in LEVELS
WITH T_EC_SETOR_PERFIL_CICLO AS (
SELECT 1 CD_ESTRUTURA_COMERCIAL, 200712 NM_CICLO_OPERACIONAL,63 CD_INDICADOR ,3.00 VL_INDICADOR FROM DUAL UNION
SELECT 2,200712,63,1.00 FROM DUAL UNION
SELECT 4,200712,63,1.00 FROM DUAL UNION
SELECT 5,200712,63,3.00 FROM DUAL UNION
SELECT 6,200712,63,4.00 FROM DUAL UNION
SELECT 7,200712,63,1.00 FROM DUAL UNION
SELECT 8,200712,63,2.00 FROM DUAL UNION
SELECT 9,200712,63,5.00 FROM DUAL UNION
SELECT 11,200712,63,6.00 FROM DUAL UNION
SELECT 13,200712,63,8.00 FROM DUAL UNION
SELECT 16, 200712,63,4.00 FROM DUAL )
SELECT * FROM T_EC_SETOR_PERFIL_CICLOSomebody can help me, because my solution is with COST high
TIA
That plan is better, don't know why you did not post
this follow up in your old thread, where I asked
whether
[url=http://forums.oracle.com/forums/message.jspa?m
essageID=2330090#2330090]42 billion rows
was roughly the size of the results you expected.
If you widen your sqlplus window and set linesize
140 it would look like the output below.
Unfortunately then we can see things like this
| 50 | VIEW |
| 120T| 5474T|
| 148G (96)|999:59:59 |
Where I believe the T in 120T stands for
tera[
/b] or 120 trillion rows, that is 120,000,000,000,000
or a right
shedfull as it is sometimes known. The next step is
to sort these rows, which could take some time,
999:59:59
is the estimate which looks suspiciously like just
the biggest number the optimizer can produce.
In your query you have several connect by statements
but no start withs. This will generate every possible
permutation
of the hierarchy, I think in one place the results
are used as the input of another query that then
regenerates every
possible permutation of that hierarchy.
In these cases I am not really sure what you think
you are trying to do apart from generate the biggest
result set
ever known to mankind. This is what happens to the 14
row emp table when subjected to some of these
queries. What
are the original row counts of the tables you are
doing this to in the query?
SQL> select count(*)
2 from emp
3 start with mgr is null
4 connect by mgr = prior empno;
COUNT(*)
14
elect count(*)
2 from emp
3 connect by mgr = prior empno;
COUNT(*)
39
di
Wrote file afiedt.buf
1 select count(*) from
2 (
3 select mgr, empno
4 from emp
5 connect by mgr = prior empno
6 )
7* connect by mgr = prior empno
L> /
COUNT(*)
261
The formatted plan
[pre]
Execution Plan
Plan hash value: 3341212558
| Id | Operation | Name
| Rows | Bytes |TempSpc| Cost
(%CPU)| Time |
| 0 | SELECT STATEMENT |
| 48G| 2910G| |
150G (95)|999:59:59 |
1 | TEMP TABLE TRANSFORMATION |
| | | |
| |
OAD AS SELECT |
| | | |
| |
HASH GROUP BY |
| 13 | 2366 | |
14 (29)| 00:00:01 |
4 | VIEW |
| 13 | 2366 |
| 13 (24)| 00:00:01 |
| NESTED LOOPS OUTER |
| 13 | 949 | |
13 (24)| 00:00:01 |
6 | VIEW |
| 13 | 845 |
| 8 (38)| 00:00:01 |
| SORT UNIQUE |
| 13 | 1150 | |
8 (63)| 00:00:01 |
8 | UNION-ALL |
| | | |
| |
VIEW |
| 12 | 1092 | |
3 (0)| 00:00:01 |
0 | NESTED LOOPS |
| 12 | 516 | |
3 (0)| 00:00:01 |
1 | VIEW |
| 11 | 319 | |
3 (0)| 00:00:01 |
2 | TABLE ACCESS FULL |
GRUPO_RELACAO | 11 | 88 | |
3 (0)| 00:00:01 |
3 | TABLE ACCESS BY INDEX ROWID |
M_ESTRUTURA_COMERCIAL_CAD | 1 | 14 | |
0 (0)| 00:00:01 |
4 | INDEX UNIQUE SCAN |
I0_ESTRUTURA_COMERCIAL | 1 | | |
0 (0)| 00:00:01 |
5 | HASH JOIN ANTI |
| 1 | 58 | |
3 (34)| 00:00:01 |
6 | VIEW |
| 12 | 660 | |
1 (0)| 00:00:01 |
7 | NESTED LOOPS |
| 12 | 204 | |
1 (0)| 00:00:01 |
8 | VIEW |
| 11 | 33 | |
1 (0)| 00:00:01 |
9 | INDEX FULL SCAN |
GRP_RELAC_PK | 11 | 33 | |
1 (0)| 00:00:01 |
0 | TABLE ACCESS BY INDEX ROWID|
M_ESTRUTURA_COMERCIAL_CAD | 1 | 14 | |
0 (0)| 00:00:01 |
1 | INDEX UNIQUE SCAN |
I0_ESTRUTURA_COMERCIAL | 1 | | |
0 (0)| 00:00:01 |
2 | INDEX FULL SCAN |
GRP_RELAC_PK | 11 | 33 | |
1 (0)| 00:00:01 |
3 | VIEW |
| 1 | 8 | |
0 (0)| 00:00:01 |
4 | INLIST ITERATOR |
| | | |
| |
TABLE ACCESS BY INDEX ROWID |
T_EC_SETOR_PERFIL_CICLO | 1 | 23 | |
0 (0)| 00:00:01 |
6 | INDEX RANGE SCAN |
I0_SETOR_PERFIL_CICLO | 1 | | |
0 (0)| 00:00:01 |
7 | LOAD AS SELECT |
| | | |
| |
SORT UNIQUE |
| 2 | 129 | |
4818K (57)| 16:03:40 |
29 | UNION-ALL |
| | | |
| |
VIEW |
| 1 | 59 | |
2409K (13)| 08:01:50 |
31 | SORT UNIQUE |
| 1 | 81 | |
2409K (13)| 08:01:50 |
32 | WINDOW SORT |
| 1 | 81 | |
2409K (13)| 08:01:50 |
* 33 | VIEW |
| 1 | 81 | |
2409K (13)| 08:01:50 |
34 | SORT UNIQUE |
| 1 | 91 | |
2409K (13)| 08:01:50 |
* 35 | CONNECT BY WITHOUT FILTERING |
| | | |
| |
COUNT |
| | | |
| |
VIEW |
| 316M| 26G| |
2193K (4)| 07:18:39 |
38 | TABLE ACCESS FULL |
SYS_TEMP_0FD9D6A2F_44B054AC | 316M| 26G| |
2193K (4)| 07:18:39 |
39 | VIEW |
| 1 | 70 | |
2409K (13)| 08:01:50 |
40 | SORT UNIQUE |
| 1 | 65 | |
2409K (13)| 08:01:50 |
41 | WINDOW SORT |
| 1 | 65 | |
2409K (13)| 08:01:50 |
* 42 | VIEW |
| 1 | 65 | |
2409K (13)| 08:01:50 |
43 | SORT UNIQUE |
| 1 | 91 | |
2409K (13)| 08:01:50 |
* 44 | CONNECT BY WITHOUT FILTERING |
| | | |
| |
COUNT |
| | | |
| |
VIEW |
| 316M| 26G| |
2193K (4)| 07:18:39 |
47 | TABLE ACCESS FULL |
SYS_TEMP_0FD9D6A2F_44B054AC | 316M| 26G| |
2193K (4)| 07:18:39 |
48 | WINDOW BUFFER |
| 48G| 2910G| |
150G (95)|999:59:59 |
49 | MERGE JOIN SEMI |
| 48G| 2910G|
| 148G (96)|999:59:59 |
| VIEW |
| 120T| 5474T| |
148G (96)|999:59:59 |
51 | SORT ORDER BY |
| 120T| 9P|
23P| 148G (96)|999:59:59 |
52 | MERGE JOIN OUTER |
| 120T| 9P| |
6506M(100)|999:59:59 |
53 | SORT JOIN |
| 1900M| 42G| 128G|
38M (9)|126:57:43 |
54 | VIEW |
| 1900M| 42G| |
13M (13)| 46:09:55 |
55 | SORT UNIQUE |
| 1900M| 23G| 71G|
13M (71)| 46:09:55 |
56 | UNION-ALL |
| | | |
| |
VIEW |
| 633M| 7853M| |
91649 (100)| 00:18:20 |
| 58 | TABLE ACCESS FULL |
SYS_TEMP_0FD9D6A30_44B054AC | 633M| 50G| |
91649 (100)| 00:18:20 |
| 59 | VIEW |
| 633M| 7853M| |
91649 (100)| 00:18:20 |
| 60 | TABLE ACCESS FULL |
SYS_TEMP_0FD9D6A30_44B054AC | 633M| 50G| |
91649 (100)| 00:18:20 |
| 61 | VIEW |
| 633M| 7853M| |
91649 (100)| 00:18:20 |
| 62 | TABLE ACCESS FULL |
SYS_TEMP_0FD9D6A30_44B054AC | 633M| 50G| |
91649 (100)| 00:18:20 |
|* 63 | SORT JOIN |
| 633M| 40G| 99G|
18M (4)| 60:03:28 |
64 | VIEW |
| 633M| 40G| |
91649 (100)| 00:18:20 |
| 65 | TABLE ACCESS FULL |
SYS_TEMP_0FD9D6A30_44B054AC | 633M| 50G| |
91649 (100)| 00:18:20 |
|* 66 | SORT UNIQUE |
| 1 | 14 | |
1 (100)| 00:00:01 |
7 | TABLE ACCESS BY INDEX ROWID |
M_ESTRUTURA_COMERCIAL_CAD | 1 | 14 | |
0 (0)| 00:00:01 |
8 | INDEX RANGE SCAN |
I0_ESTRUTURA_COMERCIAL | 811 | | |
0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
14 - access("W1"."CD_TIPO_ESTRUTURA_COMERCIAL"=5
AND
"W2"."CD_EC_AFILHADA"="W1"."CD_ESTRUTURA_COMERCIAL")
15 - access("CD_EC_AFILHADA"="W2"."CD_EC_MADRINHA")
21 - access("W1"."CD_TIPO_ESTRUTURA_COMERCIAL"=5 AND
"W2"."CD_EC_MADRINHA"="W1"."CD_ESTRUTURA_COMERCIAL")
26 - access("W"."CD_TIPO_ESTRUTURA_COMERCIAL"=5 AND
"T"."CD_EC_AFILHADA"="W"."CD_ESTRUTURA_COMERCIAL"
AND
"W"."NM_CICLO_OPERACIONAL"=200712 AND
"W"."CD_PERFIL"=1 AND ("W"."CD_INDICADOR"=0 OR
"W"."CD_INDICADOR"=63))
33 - filter("CD_EC_AFILHADA"<>"PARENT" AND
"CD_SETOR"=16 AND "ID_ESTRUTURA_ATIVA"=1)
35 - access("CD_EC_MADRINHA"=PRIOR
"CD_EC_AFILHADA")
filter("ID_ESTRUTURA_ATIVA"=1)
filter("CD_SETOR"=16 AND "ID_ESTRUTURA_ATIVA"=1)
44 - access("CD_EC_MADRINHA"=PRIOR
"CD_EC_AFILHADA")
filter("ID_ESTRUTURA_ATIVA"=1)
access("T1"."LVL"="T2"."LVL"(+))
filter("T1"."PARENT"="T2"."PARENT"(+) AND
"T1"."LVL"="T2"."LVL"(+))
66 - access("T3"."CD_ESTRUTURA_COMERCIAL"="PARENT")
filter("T3"."CD_ESTRUTURA_COMERCIAL"="PARENT")
filter("T3"."CD_SETOR"=16 AND
"T3"."ID_ESTRUTURA_ATIVA"=1)
68 - access("T3"."CD_TIPO_ESTRUTURA_COMERCIAL"=5)
/pre]Hi thank
In your query you have several connect by statements
but no start withs. This will generate every possible
permutationPlease, [b] in my example how can put a start with, that walk all tree ?
Similar Messages
-
Connect by hierarchical and summary
Hi
I must to resolve this problem , but I do not know
SQL> WITH T_TREE AS (
2 SELECT 5 CD_TYPE_PARENT,
3 1 CD_EC_PARENT ,
4 2997660 CD_PARENT,
5 5 CD_TYPE_CHILD,
6 2 CD_EC_CHILD,
7 12239615 CD_CHILD,
8 1 ID_TYPE_RELATION,
9 200701 NM_CYCLE ,
10 TO_NUMBER(NULL) NM_CYCLE_END FROM DUAL
11 UNION
12 SELECT 5,1,2997660,5,4,10509356,1,200701,TO_NUMBER(NULL) FROM DUAL
13 UNION
14 SELECT 5,2,12239615,5,5,13392131,1,200701,TO_NUMBER(NULL) FROM DUAL
15 UNION
16 SELECT 5,2,12239615,5,6, 4701040,1,200701,TO_NUMBER(NULL) FROM DUAL
17 UNION
18 SELECT 5,4,10509356,5,7,10812806,1,200701,TO_NUMBER(NULL) FROM DUAL
19 UNION
20 SELECT 5,5,13392131,5,9,22016740,1,200801,TO_NUMBER(NULL) FROM DUAL
21 UNION
22 SELECT 5,4,10509356,5,8, 7769790,1,200701,TO_NUMBER(NULL) FROM DUAL)
23 SELECT * FROM T_TREE;
CD_TYPE_PARENT CD_EC_PARENT CD_PARENT CD_TYPE_CHILD CD_EC_CHILD CD_CHILD ID_TYPE_RELATION NM_CYCLE NM_CYCLE_END
5 1 2997660 5 2 12239615 1 200701
5 1 2997660 5 4 10509356 1 200701
5 2 12239615 5 5 13392131 1 200701
5 2 12239615 5 6 4701040 1 200701
5 4 10509356 5 7 10812806 1 200701
5 4 10509356 5 8 7769790 1 200701
5 5 13392131 5 9 22016740 1 200801
7 rows selected
select CD_EC_PARENT,CD_EC_CHILD
22 from T_TREE t1
23 sTART WITH CD_EC_PARENT = 1
24 connect by prior t1.CD_EC_CHILD = t1.CD_EC_PARENT
25 order siblings by t1.CD_EC_PARENT
CD_EC_PARENT CD_EC_CHILD
1 2
2 5
5 9
2 6
1 4
4 7
4 8
where 1 is parent of 2 and 4
2 is parent of the 5 and 6
4 is parent of the 7 and 8
and 5 is parent 9
I have other table
SQL> select *
2 from t_ec_setor_perfil_ciclo w1
3 where w1.cd_tipo_estrutura_comercial = 5
4 and w1.cd_estrutura_comercial in (1,2,5,6,4,7,8,9)
5 and w1.nm_ciclo_operacional = 200803
6 and w1.cd_perfil = 1
7 and w1.cd_indicador = 32
CD_TIPO_ESTRUTURA_COMERCIAL CD_ESTRUTURA_COMERCIAL NM_CICLO_OPERACIONAL CD_PERFIL CD_INDICADOR VL_INDICADOR DT_ULTIMA_ATUALIZACAO
5 1 200803 1 32 120.00 1/22/2008
5 2 200803 1 32 112.00 1/29/2008
5 4 200803 1 32 50.00 1/29/2008
5 5 200803 1 32 95.00 1/29/2008
5 6 200803 1 32 100.00 1/29/2008
5 7 200803 1 32 0.00 1/29/2008
5 9 200803 1 32 30.00 1/29/2008I must to summary by level,
example
level 1 ( 2 and 4 ) relative parent = 1 ==> 112 + 50
level 2 ( 5, 6 ,7 ) relative parent = 1 ==> 95 + 100 + 0
For each parent I must to get only two levels and to sum and group by level
Now, I must to do same algorithm using like parent 2 where
level 1 ( 5 and 6) relative parent = 2 95 + 100
level 2 (9 ) relative parent = 2 ==> 30
Now I must to calculate with parent = 4
level 1 (7) relative a parent = 4 ==> 0
I tried to calculate as
SQL> WITH T_TREE AS (
2 SELECT 5 CD_TYPE_PARENT,
3 1 CD_EC_PARENT ,
4 2997660 CD_PARENT,
5 5 CD_TYPE_CHILD,
6 2 CD_EC_CHILD,
7 12239615 CD_CHILD,
8 1 ID_TYPE_RELATION,
9 200701 NM_CYCLE ,
10 TO_NUMBER(NULL) NM_CYCLE_END FROM DUAL
11 UNION
12 SELECT 5,1,2997660,5,4,10509356,1,200701,TO_NUMBER(NULL) FROM DUAL
13 UNION
14 SELECT 5,2,12239615,5,5,13392131,1,200701,TO_NUMBER(NULL) FROM DUAL
15 UNION
16 SELECT 5,2,12239615,5,6, 4701040,1,200701,TO_NUMBER(NULL) FROM DUAL
17 UNION
18 SELECT 5,4,10509356,5,7,10812806,1,200701,TO_NUMBER(NULL) FROM DUAL
19 UNION
20 SELECT 5,4,10509356,5,8, 7769790,1,200701,TO_NUMBER(NULL) FROM DUAL)
21 SELECT T1.CD_EC_PARENT, LEVEL , SUM(W1.VL_INDICADOR)
22 FROM T_TREE T1,
23 t_ec_setor_perfil_ciclo w1
24 WHERE T1.CD_TYPE_CHILD = W1.CD_TIPO_ESTRUTURA_COMERCIAL
25 AND T1.CD_EC_CHILD = W1.CD_ESTRUTURA_COMERCIAL
26 AND W1.NM_CICLO_OPERACIONAL = 200803
27 AND W1.CD_PERFIL = 1
28 AND W1.CD_INDICADOR = 32
29 sTART WITH CD_EC_PARENT = 1
30 connect by prior t1.CD_EC_CHILD = t1.CD_EC_PARENT
31 GROUP BY T1.CD_EC_PARENT, LEVEL ;
But the result is wrong , I did not to do it
CD_EC_PARENT LEVEL SUM(W1.VL_INDICADOR)
4 2 0
1 1 162
2 2 31200
Someboy can help me ?
thanksMaybe [url
http://forums.oracle.com/forums/thread.jspa?messageID=
1850459��]this thread will help you.Regards,
Rob.
Thank you
I neeed
WITH T_TREE AS (
SELECT 5 CD_TYPE_PARENT,
1 CD_EC_PARENT ,
2997660 CD_PARENT,
5 CD_TYPE_CHILD,
2 CD_EC_CHILD,
12239615 CD_CHILD,
1 ID_TYPE_RELATION,
200701 NM_CYCLE ,
TO_NUMBER(NULL) NM_CYCLE_END FROM DUAL
UNION
SELECT 5,1,2997660,5,4,10509356,1,200701,TO_NUMBER(NULL) FROM DUAL
UNION
SELECT 5,2,12239615,5,5,13392131,1,200701,TO_NUMBER(NULL) FROM DUAL
UNION
SELECT 5,2,12239615,5,6, 4701040,1,200701,TO_NUMBER(NULL) FROM DUAL
UNION
SELECT 5,4,10509356,5,7,10812806,1,200701,TO_NUMBER(NULL) FROM DUAL
UNION
SELECT 5,5,13392131,5,9,22016740,1,200801,TO_NUMBER(NULL) FROM DUAL
UNION
SELECT 5,4,10509356,5,8, 7769790,1,200701,TO_NUMBER(NULL) FROM DUAL)
select * from t_tree; I must to sum by level with two levels below doing join with other table
1[120]
2[112] 4[50]
5[95] 6[100] 7[0]
|
|
9[30]Example :
for Parent 1
Level 1 112 + 50 = 162
Level 2 95 + 100 + 0 ==195
for parent 2
Level 1 95 + 100 = 195
Level 2 30
for prent 4
level 1 = 0
The other Table is
SQL> select *
2 from t_ec_setor_perfil_ciclo w1
3 where w1.cd_tipo_estrutura_comercial = 5
4 and w1.cd_estrutura_comercial in (1,2,5,6,4,7,8)
5 and w1.nm_ciclo_operacional = 200803
6 and w1.cd_perfil = 1
7 and w1.cd_indicador = 32;
CD_TIPO_ESTRUTURA_COMERCIAL CD_ESTRUTURA_COMERCIAL NM_CICLO_OPERACIONAL CD_PERFIL CD_INDICADOR VL_INDICADOR DT_ULTIMA_ATUALIZACAO
5 1 200803 1 32 120.00 1/22/2008
5 2 200803 1 32 112.00 1/29/2008
5 4 200803 1 32 50.00 1/29/2008
5 5 200803 1 32 95.00 1/29/2008
5 6 200803 1 32 100.00 1/29/2008
5 7 200803 1 32 0.00 1/29/2008
Only a tip , Is best to use MODEL ? -
Reporting Question - Detail and Summary info in the same report
Hello All,
I have a situation where I have to report the detail and summary information from one cube (or multiple cubes) in a single report. Following is the example cube with smaple data and the required report
Cube - Char - 0CUSTOMER
0MATERIAL
0MATL_GRP
0CURRENCY
Key Fig - 0AMOUNT
Data
0CUSTOMER 0MATERIAL 0MATL_GRP 0AMOUNT 0CURRENCY
CUS1 MAT1 GRP1 1000 USD
CUS1 MAT2 GRP1 2000 USD
CUS1 MAT3 GRP2 3000 USD
CUS1 MAT4 GRP2 4000 USD
CUS2 MAT2 GRP1 2222 USD
If I run a report to See Which Customers have bought Material MAT1, I want to produce a report like
Material Cust Matl_Gr Amt(Matl) Amt(Cust/Mtgr) Amt(Cust)
MAT1 CUS1 GRP1 1000 USD 3000 USD 10000 USD
MAT1 CUS2 GRP1 2222 USD 2222 USD 2222 USD
Any Ideas to create such a report is welcome. I am open to use multiple cubes, Multicubes, summarized data joins etc.
Thanks in advance for the help.
Amit GuptaAmit,
You can acheive this using single cube.
All you need to do is to define 2 restricted keyfigures the following way.
1. Amount (Cust/Material Group)
In the Restricted KF (either global or local), pull in the Material to the right side, right click on it and select "Constant Selection". Save it.
2. Amount (Customer)
Pull in both Material and Material Group and do the same step as above for both. Save it.
Now run the query and tests it. Let us know if i worked.
Gova -
Line item and summary settlement in AUC
Hi
What is the difference between line item and summary settlement with reagrds to AUC,In what cases they are going to be used ,can any one provide me some examples.
Thanks
LilyHi,
In WBS, there would be n number of line items in the Investment Projects.
So while doing settlement for those, we can decide whether to do on WBS based or Line items based.
These settings will be done by CO people.
Regards,
Maheswaran. -
The column headings in my Response and Summary views have disappeared
The column headings in my Response and Summary vews have disappeared. I have seen others have had this problem and that the work arounds discussed do not work.
Can Adobe please advise when this bug is going to be fixed?Hi;
This is not likely to be a bug but users selecting all rows to clean up responses and deleting. Doing a "Crtl+A" will select the Header row - there is a warning dialog before allowing you to delete the header row but it still happens all the time:
See this FAQ for how to fix the Headers, if you already looked at the History you'll want to read the part about "touching" each fields label to "fix" the headers:
http://forums.adobe.com/docs/DOC-4071
Thanks,
Josh -
[Special Prices for Business Partners] and [Hierarchies and Expansions]
Dear Sirs,
I am running into three problems.
1.) I loaded 313 items Special Prices by DTW however I can not locate where it went?
I searched via the path [Inventory>Price Lists>Special Prices>Special Prices for Business Partners]but find nothing in there.
2.) I can not find DTW templates for Hierarchies and Expansions data load.
Also I searched via the path [Inventory>Price Lists>Special Prices>Hierarchies and Expansions] to see if the Special Prices I loaded with DTW maybe there but find nothing there.
3.) I can not find any information related to Hierarchies and Expansions in the [diapi] help file.
Could it be these two functionalities require "manual" input?
If so, how on earth the 313 Special Prices DTW data load went through "successfully" and find no trace of it?
I am pulling my hair off to find some advice.
Would appreciate it greatly if someone could enlighten me on these two functionalities.
Kuni - Tokyo
Edited by: furuya kunitomo on May 15, 2009 2:28 PMHi Kuni,
To quickly answer your questions:
1.) I loaded 313 items Special Prices by DTW however I can not locate where it went?
The path is correct. If you can't find anything probably something went wrong in the DTW import.
Check that the "Test Run" checkbox was not checked and all required keys are entered in the templates.
2.) I can not find DTW templates for Hierarchies and Expansions data load.
The relevant templates are:
SpecialPrices.xlt
SpecialPricesDataAreas.xlt
SpecialPricesQuantityAreas.xlt
the default location when installing DTW is:
C:\Program Files\SAP\Data Transfer Workbench\Templates\Templates\oSpecialPrices
When entering Hierarchies and Expansions (renamed to Period and Volume Discount in Version 2007) you must enter *x for CardCode where x is the price list number.
3.) I can not find any information related to Hierarchies and Expansions in the diapi help file.
The information in the DI API file is under the SpecialPrices Object.
See below some general information regarding special prices:
SpecialPrices is a business object part of the Inventory and Production module under
Select Inventory > Price Lists > Special Prices > Special Prices for Business Partners.
OR
Select Inventory > Price Lists > Period and Volume Discount (Hierarchies and Expansions in previous versions)
Interesting points:
Source table: OSPP
DTW Template: SpecialPrices.csv
Mandatory fields in SAP Business One: CardCode and ItemCode.
PriceListNum is a foreign key to the PriceLists object - source table OPLN, field name ListNum.
CardCode is the Business Partner CardCode to enter Special Prices for Business Partners.
Child object of the SpecialPrices Object: SpecialPricesDataAreas (source table: SPP1)
DTW Template: SpecialPricesDataAreas.csv
LineNum (Field name LINENUM) - Always enter the appropriate LineNumber you want to update (starts from 0).
Child object of the SpecialPricesDataAreas Object: SpecialPricesQuantityArea (source table: SPP2)
DTW Template: SpecialPricesQuantityAreas.csv
LineNum (Field Name SPP2LNum). Always enter the appropriate LineNumber you want to update (starts from 0).
Hope that information helps a little. If you have any fruther questions enter the following information:
1. SAP Business One Version including Patch level
2. Do you get any error message after the import? What is the message returned?
Kind Regards,
Friederike Mundt
SAP Business One Forums Team -
What are the config steps for contract hierarchies and vendor hierarchies?
Hi friends
what are the config steps for contract hierarchies and vendor hierarchies?
Regards
Raj KumarContract hierarchies
A function that enables users authorized to create a purchasing contract to define relationships between super- and subordinate contracts.
A contract hierarchy consists of one or multiple contracts and is subject to the following rules:
The top node of the hierarchy cannot have a superordinate contract
Every contract except for the top node has exactly one superordinate contract
Every contract can have none, one, or multiple subordinate contract(s)
A contract can be part of no hierarchy or exactly one hierarchy
Note:Contract hierarchies are only available for purchasing contracts. They are not available for global outline agreements.
You can activate this from SRM Server> Cross application settings>Activate Hierarchies for Product Categories, Vendors, and Contracts.
Note:
These hierarchy functions should not be reset once they have been activated.
Similiarly you can do this for Vendor Hirerachies.
Please visit link for more details: http://help.sap.com/saphelp_srm50/helpdata/en/43/2022b83fbc2be8e10000000a11466f/content.htm
Thanks -
Extraction hierarchies and fields from the logical layer
Hello all !
I build a repository and I would like to ask if it is possible to take an extraction of the names of the hierarchies and fields of the business layer that are mapped to the tables and fields of the physical layer. Because now my model is quite big and I want to create a file that I can follow my logical layer that is mapped to the physical layer.
Thank you in advance!better to go for Repository Documnetation from utilities,it will give you the complete info of ur RPD
-
Exists object for hierarchies and expansions??
hello;
I want to get values frrom hierarchies and expansions,but i dont search a object to "open",like oItems = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
,for example.
how can i do it?
i try to get values with a instrucction like getbykey but i dontHi,
there is no object to access the hierarchies and expansions directly.
but you can try the following
Dim oSP As SAPbobsCOM.SpecialPrices '// access special prices
oSP.SpecialPricesDataAreas '// access pricelist item details by period
oSP.SpecialPricesDataAreas.SpecialPricesQuantityAreas '// access the special prices hierarchies
regards
David -
Planner profile SAPFAGL and Summary Table is FAGLFLEXT
Dear Friends,
I am not able to enter plan data (Version 1) for Planner profile SAPFAGL and Summary Table is FAGLFLEXT.
Whenever i try to enter plan data, got error message GLS0 is not available. Why..?
Is there way to enter plan data (version 1) in Summary Table is FAGLFLEXT.....? We are in ECC 6.0. Please help me. Thanks in Advance.
I will give more points for this solution.
VK.Hi VK,
Please find the details.
You must/can start the selection with the following parameters:
1. Company Code (required entry field)
Enter the company code of the accruals account to be checked.
2. G/L Account (required entry field)
Enter the accruals account to be checked.
3. Posting Period/Year To (required entry fields)
Enter the period to be checked in posting periods.
4. Indicator: Only Not Cleared Documents (optional entry field)
If you set this indicator, only actions with an incomplete revenue recognitions (revenue postings and billing document postings) are taken into account, because only these postings are necessary for an explanation of the balance. However, to trace the balance, it may be necessary for the system to also display completed (cleared) revenue recognition processes. In this case, the indicator must not be set, which generally has a negative effect on runtime.
Note: The periods in the SD tables are determined by the posting date in the VBREVE and VBREVR tables.
If the necessary selection parameters were set and the report is started, a split screen appears.
1. Upper part of the screen - Balances
This is where different balances are displayed for each currency in the form of a calculation. The calculation consists of the following:
a) Balance from revenue recognitions
This balance is determined from the posted revenue lines in the VBREVE table. These are the revenue amounts that were recognized in the selected period according to SD.
b) - Balance from billing documents
This balance is determined from the posted, billing items in the VBREVR table that are relevant for revenue recognition. These are the revenue amounts that were deferred in the selected period according to SD.
c) - Balance from other postings
If not only the revenue recognition process (VF44/VF46/VF01/VF02/VFX3) but also other FI transactions such as FB01 posted to the selected accruals account, then these values are not known in SD (VBREVx tables). This appears to result in an inconsistency between SD and FI, but there really is no inconsistency at all.
The system now takes the balance from revenue recognitions, minus the balance from billing documents, and compares the result with the total balance in FI. If there is a difference, the other postings on the selected accruals account for the selected period in FI are read. The result is the 'Balance from other postings.' If this balance is now also subtracted from the previous result, the determined value must result in the total balance from FI.
d) Total balance
This is the balance of the accruals account for the selected period that was determined in FI. If you now take the balance of revenue recognitions, minus the balance of billing documents and minus the balance of other postings, then the result should reflect the total balance in FI. If this is not the case, this result must be analyzed further, since there is an inconsistency between FI and SD. Transactions VF47 and VF45 (among others) are available for further analysis.
2. Lower part of the screen - VBREVx rows (SD tables)
This is where SD detail data (VBREVx tables) concerning the selection at sales and distribution document item level is listed (the total in the 'Balance' column must equal the total balance in FI). If the totals are different, there are inconsistencies between FI and SD.
The following values are displayed for the items:
a) Billed revenues
For the relevant document item, the revenue billed in the selected period is displayed, based on the billing items relevant for revenue recognition (this is the revenue that was posted to the selected accruals account). Data is retrieved using the reference line table (VBREVR).
b) Recognized revenues
For the relevant document item, the revenue recognized in the selected period is displayed, based on the VBREVE table (this is the revenue that was posted to the selected accruals account). Data is retrieved using the revenue line table (VBREVE).
c) Accrued total value
This is the revenue amount of the document item to be recognized at accruals account level. Data is retrieved using the control row table (VBREVK) in which the relevant accrued total value is updated.
d) Balance
This balance at document item level is calculated by subtracting the recognized revenues from the billed revenues.
3. In addition to the screen described above, you can also receive more detailed information. The functions for the displayed ALV buttons are as follows:
a) Billing documents (F5)
This is where the billing items that are relevant for the selected document item are displayed. A jump to the respective billing document is also possible.
b) Other FI documents (F6)
If balances exist from other postings, the accounting documents which resulted in these balances are displayed here. A jump to the respective accounting document is also possible.
c) Overview (F7)
This is where the revenue recognition data that is relevant for the selected document item is listed. This is done in Transaction VF45 - 'Revenue Recognition: Overview.'
Implementation
1. Use Transaction SE38 to create the following program:
Name.....: SDRRAV53
Title....: Compare report for revenue recognition
Create without a top include.
Attributes
Type.............: Executable program
Status...........: SAP Standard Production Program
Application......: Sales
Development class: VFE
2. Use Transaction SE11 to create the following structures in the VFE development class:
a) Data type (structure): VBREVBSIS
Short text...........: Output Structure for SDRRAV53
Enhancement category.: can be enhanced (deep)
(from Release 4.70)
Component Component type Ref field Ref table
BUKRS BUKRS
BELNR BELNR_D
GJAHR GJAHR
HKONT HKONT
BUDAT BUDAT
WAERS WAERS
MONAT MONAT
SHKZG SHKZG
WRBTR WRBTR WAERS VBREVBSIS
ZUONR DZUONR
TCODE TCODE
AWTYP AWTYP
AWKEY AWKEY
b) Data type (structure): VBREVDETAIL
Short text...........: Detailed Structure for SDRRAV53
Enhancement category.: can be enhanced (character-type or numeric)
(as of Release 4.70)
Component Component type Ref field Ref table
VBELN VBELN
POSNR POSNR
WAERS WAERS
VBREVR_WRBTR WRBTR WAERS VBREVDETAIL
VBREVE_WRBTR WRBTR WAERS VBREVDETAIL
VBREVK_WRBTR WRBTR WAERS VBREVDETAIL
VBREVK_BAL WRBTR WAERS VBREVDETAIL
c) Data type (structure): VBREVSALDO
Short text...........: Balance Table for SDRRAV53
Enhancement category.: can be enhanced (character-type or numeric)
(as of Release 4.70)
Component Component type Ref field Ref table
WAERS WAERS
SALDO WRBTR WAERS VBREVSALDO
ORDERSALDO WRBTR WAERS VBREVSALDO
FAKTURASALDO WRBTR WAERS VBREVSALDO
RESTSALDO WRBTR WAERS VBREVSALDO
d) Data type (structure): VBREVINVOICE
Short text...........: Billing Data for SDRRAV53
Enhancement category.: can be enhanced (character-type or numeric)
(as of Release 4.70)
Component Component type Ref field Ref table
VBELN VBELN_VF
POSNR POSNR
WAERS WAERS
WRBTR WRBTR WAERS VBREVINVOICE
3. Implement the source code attached at the end. Use the "Note Assistant" to do this.
4. Add the following text elements to the SDRRAV53 report:
a) Selection texts
Name Text Dictionary Ref
P_BUKRS Company Code 'X'
P_HKONT G/L Account 'X'
P_OPEN only Not Cleared Documents ' '
b) Text symbols
Sym Text dLen mLen
D01 Total Bal 11 40
D02 Balance from Revenue Recognitions_____ 35 40
D03 Balance from Billing Documents________ 33 40
D04 - Balance from Other Postings__ 33 40
D05 _____________________________ 29 40
D06 Curr 7 7
D07 Bals 6 6
D24 Bal 5 18
D25 Recognized Revenue 18 30
D26 Accrued total value 25 40
D27 Billed Revenues 18 40
E01 Period 8 8
E02 Acct 5 5
E03 Control 9 9
E04 Posting Period/Year 20 20
E05 To 3 3
Start Transaction SE38 or SE80. Under the menu option "Goto" you will find the menu option "Text elements." Here you can make the changes listed above.
5. Create the GUI statuses INVOICE and STANDARD.
a) Copy the STANDARD statuses from the SAPLSALV program and remove the following FCODES: &ALL, &SAL, &NFO, &NTE, &CRB, &CRE, &ABC, &CRL, &CRR, &XPA, &EB9, &RNT_PREV, &OMP, &XML.
b) Add the following functions to the STANDARD status in the new program:
FCODE DETA
F-key Function text Icon name Info text
F5 Billing documents ICON_OVERVIEW Billing documents
FCODE REST
F-key Function text Icon name Info text
F6 Other FI documents ICON_FINANCING Other FI documents
FCODE VF45
F-key Function text Icon name Info text
F7 Overview ICON_PERIOD Revenue recognition overview
6. Use Transaction SE93 to create the following transaction:
Transaction code.: VF48 (Report transaction)
Development class: VFE
Transaction text.: Revenue recognition: Compare report
Program..........: SDRRAV53
Selection screen.: 1000
Classification
'x' - Professional User Transaction
GUI capability
'x' - SAP GUI for HTML
'x' - SAP GUI for Java
'x' - SAP GUI for Windows
7. Save and activate the objects that you have created.
Header Data
Release Status: Released for Customer
Released on: 16.11.2005 15:44:32
Master Language: German
Priority: Correction with high priority
Category: Advance development
Primary Component: SD-BIL-RR Revenue Recognition
regards,
Srinivas Muthyala -
Data Federator - Hierarchies and Text Descriptions
Hi,
I am trying to create WEBI reports on the top of SAP BW. The universe is connecting to SAP BW via Data Federator. I am facing issues with the hierarchy creation. The hierarchies created in the InfoProvider (Multicube - from CRM data source) are not available in the Universe. I can't create the hierarchies in the universe as all the levels of the hierarchy are not available in the multicube. I need to get the hierarchy data from the CRM data source directly. But the valid sources for DF with respect to SAP BW are just cubes. Kindly let me know if there are any workarounds. Please let me know if more details are needed.
Thanks in advance.
Regards.Hi
Officially SAP BW hierarchies are not suppoerted for the Data Federator (http://wiki.sdn.sap.com/wiki/display/BOBJ/LeveragingDataFederatorinSAP+integrations). What you can do is to use also the SAP R/3 connector (SAP BusinessObjects Web Intelligence Reporting for SAP ERP [original link is broken] .Note this is prototype not a product) and fetch your CRM data also in the virtual tables of the DF. Still you have to rebuild your hierarchies manually in the universe.
Regards,
Stratos -
Functions in Calculation and Summary Fields
Hi,
I'll give a bit of background to my situation before describing the advice I'm looking for here.
I am experienced Mac user and I have used AW a fair bit in the past, but since I've been working in a job which has Windows machines and uses a complex custom-written relational database for its main tool, I use it less often than I did, so I am a little rusty. It is the shortcomings of the complex relational database (which I do not have admin rights to) that has led me back to AW and its database module.
Essentially, I am a complaints investigator, and the relational database provided by my employer is used to keep track of correspondence and various metadata associated with the investigation of the complaint. However, although it is called a Complaints Management System (CMS), it does not help me manage my caseload very well. I've previously tried to create an Excel spreadsheet that would help me manage my work, but it is not a database (or I am not sufficiently skilled with Excel) and I cannot get it to provide me with what I want.
So, my problems.
I have complaints (cases) assigned to me to investigate. These cases have differing priorities, which means differing time limits for completion of the investigation. The priorities and time limits are set out below:
J (jurisdictional issues) - time limit = 1 month
D (discretion not to investigate) - time limit = 3 months
1 - time limit = 4 months
2 - time limit = 6 months
3 - time limit = 12 months
The priority field in my AW DB is currently a 'pop-up menu' field, but I could change this to another type if this would be advisable.
I have a date-type field in which I enter the date the complaint was received. I have an calculation-type field in which I calculate the age of the complaint using the function:
=(NOW()-'DateReceived')
This returns an age in days, which I input into a separate calculation field that divides the result of 'age in days' by 30, to give a rough approximation of the number of months old the complaint is (If AW has an equivalent to Excel's 'workdays' variable, I'd love to hear about it). This latter field is the one that I display in the main data entry view of the database.
Given the priority assigned to the complaint, and the age of it, I am either 'On Target' or 'Over Target' for completing the investigation.
Each month I have a meeting with my manager to review progress, and since the reports that can be extracted from the CMS are not very useful for this purpose, I want my AW database to help me generate reports that can form the basis of discussion in these meetings.
Part A of My Query
At present, I have a manually operated field, in the form of a pop-up menu, to indicate for each record (complaint) whether I am over or on target for completion of the investigation. I would like to make this a calculated field, so that the database keeps track of this for me automatically. Unfortunately, I'm either too dense, or not good enough with the syntax of AW functions, to be able to write a function which essentially does the following:
IF 'Priority'=1 AND 'Age in Months'<4 THEN 'On Target' ELSE 'Over Target'
- and then repeats that for the other priority possibilities. It seems likely that the 'IF' function is what I'm after, but I haven't been able to get the syntax right to combine 'Priority' and 'Age in Months' in the format spelt out in the AW help, which is:
=IF(logical,true value,false value)
Getting the syntax of one part of this function right would be a good start. However, I suspect that I have a larger problem, in that I have 5 priorities to measure against and I need the overall calculation (that produces the 'On Target' or 'Over Target' results) to report in one result field. This means nesting the functions that look at the 5 priorities and 5 age limits. I've tried and failed to get the syntax of such nesting right, so advice on this is doubly welcome.
Unfortunately, I have a sneaking suspicion that unless the answer is much more concise than I imagine it to be, there will be an additional problem: AW appears to have a character limit for the length of a function string in a calculation field which may be too short for my needs. If you think this is an issue but that it can be solved through the use of intermediate fields (which don't need to be displayed in the main 'data entry' layout), I'm happy to give that a shot.
Part B of my Query
Even if the problem above cannot be solved, and I have to manually enter whether a complaint is 'On Target' or 'Over Target', I have a separate but related question for the reports I have to present to my manager.
On these reports, I would like to have a summary at the top of the first page (in a grand-summary part, I assume) which gives a count of how many complaints are 'On Target' or 'Over Target' for each priority. Below that is a sub-summary part, ordered by the type of action that must next be taken in the investigation. (Getting that right may be a subject of a separate post at a later date.) The report must, of course, only report on those complaints that are still being investigated ('open complaints') and not those which have been completed ('closed complaints'). So, I need a function in a summary field which will present an accurate count of the number of open complaints that are 'on target' for priority J (with separate summary fields that do the same thing for priorities D, 1, 2, and 3), and a separate set of summary fields that will present a count of open complaints that are 'over target' for each type of priority.
It might look a bit like this table below, with figures from the summary fields populating the cells in the third row:
Priority
J
D
1
2
3
In / Out of Target
In
Out
In
Out
In
Out
In
Out
In
Out
Number of Complaints
My guess is that it is easier to have the summary field simply count all the complaints that are on or over target for a given priority, regardless of whether they are open or closed, since the report could be based on a saved search (match) which strips out all closed complaints. But if I'm off-beam with that idea, I'm happy to have another way of cracking this nut.
Many thanks in advance to any Community members that take the time to try and help me with this.
Andrew
PS Cross posted in AWUG forum too, if people prefer to answer there.Hi Andrew,
Part A:
I've done some restating of the question, and distributed the calculations among several fields, not all of which need to be included on the visible layout. Other than formatting the Date fields and moving the 'Completed Date' field and its label, I've left this in the default "Layout 1" produced by AppleWorks.
Field List:
Priority: Popup menu with six items: 00, J, D, 1, 2, 3 Defaults to 00
TL (time limit in months): Calculation: CHOOSE('Priority',0,1,3,4,6,12)
Received: Date. Option: Automatically insert today's date (ie. Date Record created) (may be edited)
Target Date: Calculation:
DATE(YEAR('Received')+INT(MONTH('Received')+'TL')/12,MOD(MONTH('Received')+'TL', 12),DAY('Received'))
Remaining (Days): Calculation: INT('Target Date'+1-NOW()) (see revision below)
Completed: Checkbox. Set default value to Unchecked.
Completed Date: Date: Entered manually
OnTarget: Calculation: IF('Completed',IF('Completed Date'<'Target Date',"On Target","Over"),IF(INT(NOW())>'Target Date',"Over","On Target"))
The On Target field shows the current status of the case while still open, and the state on the closing date when it was closed.
Having done that, I was unhappy with the Remaining field continuing to calculate an ever larger negative number after the case had been closed. Hence this revision below:
Remaining: Calculation: IF('Completed','Target Date'-'Completed Date',INT('Target Date'+1-NOW()))
Shows the number of days remaining while the case is open, the days remaining at completion if the case has been marked Completed and the completion date entered.
Rsults (and some further formatting of the Layout) below.
Part B:
You will need Subsummary parts when sorted on Completed and on On Target. Fields can appear on a Layout only once, so each subsummary part will need a separate Summary type field for each field to be summarized.
Regards,
Barry -
Extra blank space in formula and summary fields
I have a report that gives text output. In that I have 3 fields which are numeric.
One of them has source as summary column- numeric 3 digits(format mask 000) and other 2 has source as formula column- numeric format mask (0000.00)
Here is my problem- When the value in my summary column is 3, it prints space(instead of 0) and 03,
if the value is 56, it prints a space and 56. if the value is 139, it prints a space and 139. Now this increaases the size of my line by 1 space, which is acceptable to the system that we are feeding this data.
Similar thing is happening for the formula columns, 1 space (instead of 0) and then 000.00 is printed, if the value is filling the format mask, then it will have an extra space before giving out the value 1234.56.
Can somebody please help me with the situation.
Thanks
AnnaFinally, I got the fix.
Here is what I did: Instead of the format mask '000' or '099' or '0nn' I used '000Y'
adding a Y supresses the extra space that is reserved for + or - sign. And supression need to be added at the end like I showed, not like 'Y000'.
Now my data looks like this, which is what I wanted:
04/23/20120020123.451234.5610/24/2008
If you look close, there are no spaces now as compard to my previous data line.
Thank you all both for spending some time and giving me pointers. -
Issue with Duplicate Results and Summary Fields
My report is based on an Access Database. For the purposes of this current issue, there is the Master Table called u201CCnu201D and then a related u201CTable Au201D which includes multiple records related to the Master and also a related u201CTable B,u201D also with multiple records related to the Master.
For my report, I want to output results from Table B based on criteria in Table A. This naturally produces duplicate output on the report. As a result, the Summary Fields that I want to include are incorrect.
I have tried multiple combinations of the Select Distinct function, suppression based on u201Cprevious fieldu201D being equal, summary fields, running totals and if-then statements and still cannot find a solution that works in all of the cases involved.
Below are descriptions of three different scenarios that are occurring:
EXAMPLE #1: Entry 1 has 2 records in Table A and 2 Records in Table B so "Select Distinct" including the Table B ID # and then a Summary Field for the Total produces the correct results, while a Running Total is Incorrect.
EXAMPLE #2: Entry 2 has 2 records in Table A and 1 Record in Table B so a suppression formula of the field based on the "Previous =" Table B ID # and the Running Total produce the correct results, while Summary Field is incorrect.
EXAMPLE #3: Entry 3 has 6 records in Table A and 6 Records in Table B. Neither Summary or
Running Totals produce correct results.
I would greatly appreciate any advice in terms of creative formulas, etc. that would help produce correct results here.
Iu2019ll be pulling my hair out soon! Thanks so much-Hi Berry
Try to create a command with a subquery. The subquery will be returning the the duplicate records and the main query that uses this subquery will find distinct records out of the resultset returned by the subquery.
Let me know if this helps.
Regards
Nikhil -
Ordering of formula and summary fields - Reports6i
Hello,
I want to know if it is possible to make certain order of field (XML tags) in XML.
If I have ordinary field that I get from SQL I can put it in the place that I want it to be and position in xml is OK, but when I put formula or summary field on certain place in xml file it is always on last place.
For example:
I have sql with 3 fields (one, two, three) and two formula fields (fo1, fo2). In report they are in this order:
1. one
2. fo1
3. two
4. fo2
5. three
but in xml file I get this order:
<body>
<edp:bodyContent>
</one>
</two>
</three>
</fo1>
</fo2>
</edp:bodyContent>
</body>
and I wish to have this order in xml:
<body>
<edp:bodyContent>
</one>
</fo1>
</two>
</fo2>
</three>
</edp:bodyContent>
</body>
Is this possible and if so how?
Thanks for your helpFinally, I got the fix.
Here is what I did: Instead of the format mask '000' or '099' or '0nn' I used '000Y'
adding a Y supresses the extra space that is reserved for + or - sign. And supression need to be added at the end like I showed, not like 'Y000'.
Now my data looks like this, which is what I wanted:
04/23/20120020123.451234.5610/24/2008
If you look close, there are no spaces now as compard to my previous data line.
Thank you all both for spending some time and giving me pointers.
Maybe you are looking for
-
I have done this but now the restore function is asking for yet another file, which i assume to be the original back up, but that is the only .tly file since the only other relevant file appears to be called catalog.buc but that is just not visible w
-
My Toshiba laptop went through 45 updates, and now when I open Firefox (where ALL my bookmarks live) the program freezes after a few minutes. I get error messages about my profile, and errors about Firefox already running. I tried the suggestions abo
-
Dear Experts, Please tell me the solution of the bar graph in oracle adf. when we create the bar graph from the master details table then this show the error 'please enter at least one numeric data point on the<bars:>edge. Thanks in advance.
-
Making a message pop up appear on the task bar
hi all ! Im making a pop up with a message so the person can know that the product is registered. I use this code javax.swing.JOptionPane.showMessageDialog(null,"Nueva Cita registrada","Medex",javax.swing.JOptionPane.INFORMATION_MESSAGE);The thing is
-
TWO clips snap together after deleting the one between them without command
Hi, Someone at an Apple store workshop asked today about a gap in a timeline which one usually closes by clicking "close gap", but in this case, the gap is closing immediately after the deletion without a command being entered. Does anyone know if th