Display column values as zeros
I am having three select queries with union below:
select col1, col2 from table1 where condition; -> fetches 1 record
union
select col1, col2 from table2 where condition; -> fetches no row
union
select col1, col2 from table3 where condition; -> fetches no row
so output is 1 row. example;
col1 col2
1 1
The 2nd and 3rd select doesnt fetch any record. My req is to dislplay the col values as zeros for any of 3 select statements which doesnt fetch any records from table
so req output which looks like:
col1 col2
1 1
0 0 -> norecords fetched(displaying zeros)
0 0 -> norecords fetched(displaying zeros)
Please let me know how can i do this in the query? I need to do this in the same qury and not using any functions/proc..
Edited by: user11942774 on Aug 22, 2010 4:13 AM
MichaelS wrote:
Or
SQL> var deptno1 number
SQL> var deptno2 number
SQL> begin
:deptno1 := 20;
:deptno2 := 100;
end;
PL/SQL procedure successfully completed.
SQL> select nvl (deptno, 0) deptno
from (select :deptno1 dn from dual), dept
where deptno(+) = dn
union all
select nvl (deptno, 0) deptno
from (select :deptno2 dn from dual), dept
where deptno(+) = dn
DEPTNO
20
0
2 rows selected.Note: Above worked on my old 9.8.0.2 but strange enough not on my 11.2.0.1 (Only the first part of the UNION ALL displayed)! A bug???Looks to be.
set serveroutput off
ALTER SESSION SET STATISTICS_LEVEL = ALL;
select nvl (deptno, 0) deptno
from (select :deptno1 dn from dual), scott.dept
where deptno(+) = dn
union all
select nvl (deptno, 0) deptno
from (select :deptno2 dn from dual), scott.dept
where deptno(+) = dn
8 /
DEPTNO
20
1 row selected.
Elapsed: 00:00:00.01
TUBBY_TUBBZ?SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALL'));
PLAN_TABLE_OUTPUT
SQL_ID ap0cr5cut2ucn, child number 0
select nvl (deptno, 0) deptno from (select :deptno1 dn from dual),
scott.dept where deptno(+) = dn union all select nvl (deptno, 0)
deptno from (select :deptno2 dn from dual), scott.dept where
deptno(+) = dn
Plan hash value: 18139613
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 2 (100)| |
| 1 | NESTED LOOPS OUTER | | 2 | 26 | 2 (0)| 00:00:01 |
| 2 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
| 3 | VIEW | VW_JF_SET$03B38961 | 2 | 26 | 0 (0)| |
| 4 | UNION-ALL | | | | | |
|* 5 | INDEX UNIQUE SCAN| PK_DEPT | 1 | 3 | 0 (0)| |
|* 6 | INDEX UNIQUE SCAN| PK_DEPT | 1 | 3 | 0 (0)| |
Query Block Name / Object Alias (identified by operation id):
1 - SEL$51CD7FBE
2 - SEL$51CD7FBE / DUAL@SEL$2
3 - SET$03B38961 / VW_JF_SET$03B38961@SEL$7D8CA889
4 - SET$03B38961
5 - SEL$09480F13 / DEPT@SEL$1
6 - SEL$05ED6B18 / DEPT@SEL$3
Predicate Information (identified by operation id):
5 - access("DEPTNO"=:DEPTNO1)
6 - access("DEPTNO"=:DEPTNO2)
Column Projection Information (identified by operation id):
1 - "ITEM_1"[NUMBER,22]
3 - "ITEM_1"[NUMBER,22]
4 - STRDEF[22]
5 - "DEPTNO"[NUMBER,22]
6 - "DEPTNO"[NUMBER,22]
46 rows selected.
Elapsed: 00:00:00.05So we can see through rows 5 and 6 the predicates were pushed into DEPT query (which shouldn't have happened).
A simple change to the query alleviates the bug.
select
nvl(d1.deptno, 0) as deptno
from
select :deptno1 dn from dual
union all
select :deptno2 dn from dual
) d,
scott.dept d1
where
11 d.dn = d1.deptno (+)
12 /
DEPTNO
20
0
2 rows selected.
Elapsed: 00:00:00.01
TUBBY_TUBBZ?SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALL'));
PLAN_TABLE_OUTPUT
SQL_ID 4x59nkxusp1p8, child number 0
select nvl(d1.deptno, 0) as deptno from ( select :deptno1 dn from
dual union all select :deptno2 dn from dual ) d,
scott.dept d1 where d.dn = d1.deptno (+)
Plan hash value: 1564933512
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 4 (100)| |
| 1 | NESTED LOOPS OUTER| | 2 | 32 | 4 (0)| 00:00:01 |
| 2 | VIEW | | 2 | 26 | 4 (0)| 00:00:01 |
| 3 | UNION-ALL | | | | | |
| 4 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
| 5 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN| PK_DEPT | 1 | 3 | 0 (0)| |
Query Block Name / Object Alias (identified by operation id):
1 - SEL$1
2 - SET$1 / D@SEL$1
3 - SET$1
4 - SEL$2 / DUAL@SEL$2
5 - SEL$3 / DUAL@SEL$3
6 - SEL$1 / D1@SEL$1
Predicate Information (identified by operation id):
6 - access("D"."DN"="D1"."DEPTNO")
Column Projection Information (identified by operation id):
1 - "D1"."DEPTNO"[NUMBER,22]
2 - "D"."DN"[NUMBER,22]
3 - STRDEF[22]
6 - "D1"."DEPTNO"[NUMBER,22]
43 rows selected.
Elapsed: 00:00:00.05
TUBBY_TUBBZ?I ran these tests on
TUBBY_TUBBZ?select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
5 rows selected.
Elapsed: 00:00:00.02
TUBBY_TUBBZ?
Similar Messages
-
Display column value as column name
Hi,
I have a requirement to display column names as column values and vice versa. Pls suggest how to do this.
Test data
create table oratest as select 'saurabh' "name",23 "age" from dual;
SQL> select * from oratest;
name age
saurabh 23Expected output
saurabh 23
name ageOk, I've only got 10g here at the minute, so this is what I'd do...
SQL> ed
Wrote file afiedt.buf
1 DECLARE
2 v_v_val VARCHAR2(4000);
3 v_n_val NUMBER;
4 v_d_val DATE;
5 v_ret NUMBER;
6 c NUMBER;
7 d NUMBER;
8 col_cnt INTEGER;
9 f BOOLEAN;
10 rec_tab DBMS_SQL.DESC_TAB;
11 col_num NUMBER;
12 v_rowcount NUMBER := 0;
13 v_name VARCHAR2(20);
14 v_age NUMBER;
15 v_sql VARCHAR2(4000);
16 v_str VARCHAR2(250);
17 v_und VARCHAR2(250);
18 BEGIN
19 select "name", "age"
20 into v_name, v_age
21 from oratest;
22 v_sql := 'SELECT ''name'' as "'||v_name||'", ''age'' as "'||v_age||'" from dual';
23 c := DBMS_SQL.OPEN_CURSOR;
24 DBMS_SQL.PARSE(c, v_sql, DBMS_SQL.NATIVE);
25 d := DBMS_SQL.EXECUTE(c);
26 DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
27 --
28 -- Bind local return variables to the various columns based on their types
29 FOR j in 1..col_cnt
30 LOOP
31 CASE rec_tab(j).col_type
32 WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Varchar2
33 WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val); -- Number
34 WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val); -- Date
35 ELSE
36 DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Any other type return as varchar2
37 END CASE;
38 END LOOP;
39 -- Display the header
40 FOR j in 1..col_cnt
41 LOOP
42 v_str := v_str || rpad(rec_tab(j).col_name,30,' ')||' ';
43 v_und := v_und || rpad('-',30,'-')||' ';
44 END LOOP;
45 v_str := rtrim(v_str);
46 v_und := rtrim(v_und);
47 DBMS_OUTPUT.PUT_LINE(v_str);
48 DBMS_OUTPUT.PUT_LINE(v_und);
49 --
50 -- This part outputs the DATA
51 v_str := '';
52 LOOP
53 v_ret := DBMS_SQL.FETCH_ROWS(c);
54 EXIT WHEN v_ret = 0;
55 v_rowcount := v_rowcount + 1;
56 FOR j in 1..col_cnt
57 LOOP
58 CASE rec_tab(j).col_type
59 WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
60 v_str := v_str||rpad(v_v_val,30,' ')||' ';
61 WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
62 v_str := v_str||lpad(to_char(v_n_val,'fm999999999999'),30,' ')||' ';
63 WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
64 v_str := v_str||rpad(to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),30,' ')||' ';
65 ELSE
66 DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
67 v_str := v_str||rpad(v_v_val,30,' ')||' ';
68 END CASE;
69 END LOOP;
70 v_str := rtrim(v_str);
71 dbms_output.put_line(v_str);
72 END LOOP;
73 DBMS_SQL.CLOSE_CURSOR(c);
74* END;
SQL> /
saurabh 23
name age
PL/SQL procedure successfully completed.
SQL>Now, with 11g you can actuall create the DBMS_SQL cursor from the top part of the code...
18 BEGIN
19 select "name", "age"
20 into v_name, v_age
21 from oratest;
22 v_sql := 'SELECT ''name'' as "'||v_name||'", ''age'' as "'||v_age||'" from dual';
23 c := DBMS_SQL.OPEN_CURSOR;
24 DBMS_SQL.PARSE(c, v_sql, DBMS_SQL.NATIVE);And using the new function in 11g's DBMS_SQL package called dbms_sql.to_refcursor and convert the DBMS_SQL cursor to a REF CURSOR which you can then use in your applications (if that's the way you need to go)...
http://www.oracle.com/technology/oramag/oracle/07-nov/o67asktom.html
Whatever route you take though, you won't do this simply in SQL as the column names of a query are required to be known before any data is retrieved when a query (cursor) executes. You can see that when you use the DBMS_SQL package, where the query has to be parsed and the column names and descriptions are determined before any fetching of data. -
Hey,
I am trying to only display a column value one time for a record, not a static value. The value changes and there can be many values. I do not think grouping will work since the Date value is dynamic. I am using Oracle for Toad 10.5. There are 4 records with this test data.
select Date, Person, Language, Country
from TableA
TableA
Date Person Language Country
01/25/2013 James English
12/20/2012 James English
US
AFWould like to only display
Date Person Language Country
01/25/2013 James English
12/20/2012
US
AFThanks for reading this thread!
Edited by: Nikki on Jan 7, 2013 1:08 PMHi,
You can use the analytic ROW_NUMBER function to see if a given row is the 1st row in a group, and only display the person and language columns when it is:
WITH got_r_num AS
SELECT dt -- DATE is not a good column name
, person, language, country
, ROW_NUMBER () OVER ( PARTITION BY person
, language
ORDER BY dt
) AS r_num
FROM table_x
SELECT dt
, CASE WHEN r_num = 1 THEN person END) AS person
, CASE WHEN r_num = 1 THEN language END) AS language
, country
FROM got_r_num
ORDER BY person, language, dt -- If wanted
;Your front end may also have a way to hide those values when you want. The BREAK feature in SQL*Plus does this; I don't know if Toad has anything comparable.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) where the query above produces the wrong results, and also post the right results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002} -
Hi Everyone
I don't know if this is possible or not, so I will describe it. I have a column in a table called Filing. There are currently three values in it ("Abuse", "Neglect", "Voluntary") and each record has this populated. I also have
the below slicer for the column also.
I would like to add a fourth value called "Abuse/Neglect" that would identify instances where both an Abuse and Neglect petition was filed, which is a subset of the Abuse and Neglect records in the Filing column.
My question is, is it possible to create a line chart that has the 4 Filing possibilities: "Abuse", "Neglect", "Voluntary", "Abuse/Neglect" as the Series/Legend in the line chart?
The problem is that there are records that are more than one category: Abuse or Neglect records can also be Abuse/Neglect.
PaulHi Paul,
According to your description, there is a column with the values ("Abuse", "Neglect", "Voluntary") in your table, now what you need to is that add another value "Abuse/Neglect" in this column, and then use it
as Series/Legend in the line chart, right?
In this case, you can add calculated column to your table based on your logic. A calculated column is a column that you add to an existing PowerPivot table. Instead of pasting or importing values in the column, you create a DAX formula that defines
the column values. The calculated column can be used in a PivotTable, PivotChart, or Power View report as you would any other data column. Please refer to the link below to see the details.
https://msdn.microsoft.com/en-us/library/gg413492%28v=sql.110%29.aspx?f=255&MSPPError=-2147217396
Regards,
Charlie Liao
TechNet Community Support -
Conditional suppress only if all column values are zero
I would like to suppress whole column if dbfield value is 0.00. I was able to suppress it in common tab of format field by using formula if dbfield =0.00 then true else false.
But i would like to suppress column value only when all the values in column are equal to 0.00. Otherwise I would like to retain those 0.00.
Let me know how I can do this?
Your response is appreciated
-Thanks
RaghuGo to "Format Field...", select the Common tab, and put something like the following in the Suppress formula.
Maximum({dbField}) = 0 -
Replace blank column values with ZERO
Hi experts,
I am building a report to display count of orders split by channel per day per hour.
For some days one or few channels might not have any orders placed against them in which case my report shows blank values in the report.
I would ideally like to have Zero in those columns rather than an empty cell.
Sample Qry :-
Select
Channel,
COUNT(order_num) as COUNT
FROM
SALES_ORDER
Pls help !
Thanks in advance.Try this code
/* Formatted on 2009/05/11 07:53 (Formatter Plus v4.8.8) */
SELECT a.CLASS, a.order_date, a.time_created,
NVL (a.count_orders, 0) AS count_orders
FROM (SELECT sales_order_header.soh_class AS CLASS,
TO_CHAR
(sales_order_header.soh_date_created,
'dd/mm/yyyy'
) AS order_date,
SUBSTR
(TO_CHAR (sales_order_header.soh_time_created,
'HH24:MI:SS'
1,
2
) AS time_created,
COUNT (sales_order_header.soh_order_no) AS count_orders
FROM com.sales_order_header
WHERE sales_order_header.soh_date_created >=
TRUNC (NEXT_DAY (SYSDATE, 'SUN'))
- 14
AND sales_order_header.soh_date_created <
TRUNC (NEXT_DAY (SYSDATE, 'SUN'))
- 6
GROUP BY sales_order_header.soh_class,
TO_CHAR (sales_order_header.soh_date_created, 'dd/mm/yyyy'),
SUBSTR (TO_CHAR (sales_order_header.soh_time_created,
'HH24:MI:SS'
1,
2
UNION ALL
SELECT sales_order_header.soh_own_id AS CLASS,
TO_CHAR
(sales_order_header.soh_date_created,
'dd/mm/yyyy'
) AS order_date,
SUBSTR
(TO_CHAR (sales_order_header.soh_time_created,
'HH24:MI:SS'
1,
2
) AS time_created,
NVL
(COUNT (sales_order_header.soh_order_no),
0
) AS count_orders
FROM com.sales_order_header
WHERE sales_order_header.soh_date_created >=
TRUNC (NEXT_DAY (SYSDATE, 'SUN'))
- 14
AND sales_order_header.soh_date_created <
TRUNC (NEXT_DAY (SYSDATE, 'SUN'))
- 6
GROUP BY sales_order_header.soh_own_id,
TO_CHAR (sales_order_header.soh_date_created, 'dd/mm/yyyy'),
SUBSTR (TO_CHAR (sales_order_header.soh_time_created,
'HH24:MI:SS'
1,
2
)) a
ORDER BY a.order_date DESC, a.CLASS ASC -
Display column value conditionally
Hi all,
I have a report with two columns and I would like to display the second column based on the value of the first one; if the first column is equal to 1 then show the second column :
Col1 Col2
0
1 value
1 value
0
0
I tried to put a condition on column 2 but it doesn't work (Item in Expression1 = Expression 2), "value" is never displayed ...
Best regards,
Othman.This is the right way of doing things like that:
SQL> SELECT deptno, CASE
2 WHEN deptno = 20
3 THEN ename
4 ELSE NULL
5 END ename
6 FROM emp;
DEPTNO ENAME
30
30
10
20 JONES
20 SCOTT
20 FORD
20 SMITH
30
30
30
30
DEPTNO ENAME
10
30
13 Zeilen ausgewählt.Have a look at my demo application:
http://htmldb.oracle.com/pls/otn/f?p=31517:1
You will find a lot of examples there, doing the same thing.
Denes Kubicek -
How to display item when mouse moves over Column value??
Hi there
It would be helpful if you could resolve the following :
i) I need to display the column 'A' values of my report in a Text field when mouse moves over column B of my report.
ii) I can able to display the same column value when mouse moves over or onclick happens. but my requirement is something like i have to display the other column value when mouse moves over.
iii) Also i noticed that, i can able to display the item only on "Display only Item" and not on Text field.
Any pointers to display my column value in Text field when onclick happens on my report column?
iv) One more thing that i noticed, i can able to perform onclick or mouse over only on Editable column and not on
non editable columns.
Any pointers on how to achieve the same when mouse moves over Non editable column of report?
Reference: I have created a dummy application (refer the following link), where i can able to display column value Salary on display only item using mouse move Event.
My requirement: when i click column Ename , the text field should show salary.
http://apex.oracle.com/pls/otn/f?p=56045:1
User:guest
Pswd: apex_demo
Any pointers on this would be appreciated.
Thanks
VijayVijay,
If you use Jquery then this should do the trick.
$(document).ready(function() {
$(".t20Report t20Standard tr").hover(function() {
$("#P2_SALARY").attr("innerHTML",$(this).find("td:last input").attr("value"));
{code}
after looking at the source of your page it seems that your class for your report region is *class="t20Report t20Standard"* I am not 100% sure but you might have to correct that in the template. I am not sure how the selector will handle the space in the class name.
Hope this helps,
Tyson -
FSG report not printing column values on same line but sequentially
FSG report problem:
We have defined 2 FSG reports 'Balance Sheet - Total' and 'Balance Sheet - Detail'. Both reports have 3 column values, namely the value in Euro (our Functional Currency), the value in MUR - Mauritian rupees (our reporting currency) and the rate of exchange.
The report 'Balance Sheet - Total' displays these values for assets e.g.:-
EURO MUR Rate of exchange
Non-current assets
1. Intangible assets ? ? ?
2. Other investments ? ? ?
(note: ? represents a certain value)
The report 'Balance Sheet - Detail' displays values as follows :-
Account EURO MUR Rate of exchange
1. Property & Equipment
A10101 Building Cost ? 0.00 0.0000
A20105 Motor Veh Accum Dep ? 0.00 0.0000
TOTAL ? 0.00 0.0000
A10101 Building Cost 0.00 ? n/m
A20105 Motor Veh Accum Dep 0.00 ? n/m
(note: ? represents a certain value)
What we don't understand s why the 'Balance Sheet - Detail' report repeats the display of column values in MUR FOLLOWING the display in EURO, instead of displaying column values for EURO and MUR on the same line, just like in the case for 'Balance Sheet - Total'.
Is there anything in the definition of column set, row set or report set should I change?
Can anybody help. Thanks.
nullThe problem is related to defining the column set properly. It is OK with the first report and needs modification for the second. Formatting is also important so that they appear in the same line(row). The columns need to be linked to the fileds and assignment to set of books is also important as mentioned by Rajsekhar
-
Hello Everyone,
How to update zero to a column value when record does not exist in table but should display the column value when it exists in table
Regards
Regards Gautam SAs per my understanding...
You Would like to see this
Code:
SELECT COALESCE(Salary,0) from Employee;
Regards
Shivaprasad S
Please mark as answer if helpful
Shiv -
How to add a column to a list created with the Dynamic List Wizard to display the values of the fiel
Hi,
ADDT, Vista, WAMP5.0
We have 2 tables: clients_cli (id_cli, name_cli, tel_cli, and several more fields) and cases_cas (id_cas, idcli_cas, court_cas, and a lot of other fields).
Clients may have many cases, so table cases_cas have a foreign key named idcli_cas, just to determine which case belongs to which client.
We designed the lists of the two tables with the Dynamic List Wizard and the corresponding forms with Dynamic Form Wizard.
These two forms are linked with the Convert Dynamic List and Form Wizards, which added a button to clients list named "add case".
We add a client and then the system returns to the clients list displaying all clients, we look for the new client just added and then press "add case", which opens the Dynamic Form for cases, enter all case details and everything processes ok.
However, when we view the cases list it display all the details of the case, including the column and values for the foreign key idcli_cas. As you can image, it is quite difficult for a human to remember the clients ids.
So, in the cases list we added a another column, named it Name, to display the names of the clients along with cases details. We also created another recordset rsCli, selected the clients_cli table, displaying all columns, set filter id_cli = Form Variable = idcli_cas then press the Test button and everything displays perfect. Press ok.
Then, we position the cursor inside the corresponding cell of the new Name column, go to Bindings, click on name_cli and then click on insert. The dynamic field is inserted into the table cell as expected, Save the page, and test in browser.
The browser call the cases list but fails to display the values of the Name column. The Name column is simply empty.
This issue creates a huge problem that makes our application too difficult to use.
What are we doing wrong?
Please help.
Charles1. Start transaction PM01, Create Infotype, by entering the transaction code.
You access the Create Infotype screen.
2. Choose List Screen.
3. In the Infotype no. field, enter the four-digit number of the infotype you want to create.
When you specify the infotype number, please remember to enter any leading zeros.
4. In the Screen Number field, enter the screen number of the list screen you want to enhance.
5. Choose Create.
The Dictionary: Initial screen appears:
6. Create the list screen structure.
7. Choose Activate.
8. Return to the Enhance List Screen in the Enhance Infotypes transaction (PM01).
9. Choose Create All.
The additional fields are displayed on the list screen, however, they contain no data.
The fields can be filled in the FORM routine FILL-LISTSTRUCT in the generated program ZPnnnn00. The FORM routine is called for each data record in the list.
Structure ZPLIS is identified when it is generated with a TABLES statement in the program ZPnnnn00.
The fields can be filled from the Pnnnn structure or by reading text tables. -
Display Columns having sum/total not zero
We have a report that hav total twenty columns.
Each time we run te report (dynamic query) random columns have sum=zero
we want to display eachtime only the columns having sum greater than zero.
regards
jazibHi Jazib,
Ok - I've been testing this here [http://htmldb.oracle.com/pls/otn/f?p=267:43]. The report on the left shows/hides the SAL and COMM columns according to the totals. The report on the right shows the full data. Change the Dept to see this in effect.
There are other methods available, but this is what I have done:
The dept select list (item name is P43_DEPTNO) is just a list of departments and a NULL option that returns 0 (zero).
The report's source is a SQL statement of:
SELECT EMPNO, ENAME, SAL, COMM
FROM EMP
WHERE :P43_DEPTNO = 0 OR :P43_DEPTNO = DEPTNO
ORDER BY ENAMEI have a region in the After Header position that uses "No Template" and contains two Hidden items - P43_SAL and P43_COMM.
I have an Item Computation, running "Before Header", that sets P43_DEPTNO to 0 if it is NULL.
I have an unconditional PL/SQL Process, running "On Load - Before Header", that has the following process code:
DECLARE
vSAL NUMBER;
vCOMM NUMBER;
BEGIN
SELECT NVL(SUM(SAL),0), NVL(SUM(COMM),0)
INTO vSAL, vCOMM
FROM EMP
WHERE :P43_DEPTNO = 0 OR :P43_DEPTNO = DEPTNO;
:P43_SAL := vSAL;
:P43_COMM := vCOMM;
END;And, finally, on the SAL column in the report, I have set the Condition Type to "Value of Item in Expression 1 != Zero" and Expression 1 is: P43_SAL. And the same on the COMM column, but Expression 1 is: P43_COMM
When the page is loaded, the process is run and the totals for SAL and COMM are calculated and inserted into P43_SAL and P43_COMM. The report is then run and the conditions check the values of these two hidden items - if either is non-zero, then the column is displayed.
Andy -
How to refer a column value of a single row in conditional column display?
Hello,
does anybody have an idea, how i can refer a column value of a single row in conditional display of a column?
So my idea is, that a report has a column, which value is only displayed, when another column value of this row has a specific value.
I want to solve this problem with condition type: PL/SQL Function Body returning a boolean.
But I do not know how to refer the column value of each single row!
Thank you,
TimHere's a solution that, to me, seems easier to implement but, that's, of course, in the eye of the implementer.
Rather than using APEX to generate a link column for you, actually create the link as part of your SQL.
select '<a href="f?p=102:3:491847682940364::::P3_CONTACT_ID:' || CONTACT_ID || "><img src="/i/themes/theme_1/ed-item.gif" alt="Edit"></a>' CONTACT_LINK, ...
etc.
Test this out. You'll see that it works just like making a column a link using the column attributes.
Next, we'll change the SQL to use a DECODE statement to either display the link or nothing depending on what your criteria is. For example, let's assume you only want a link for active contacts.
select Decode( CONTACT_STATUS, 'A', '<a href="f?p=102:3:491847682940364::::P3_CONTACT_ID:' || CONTACT_ID || "><img src="/i/themes/theme_1/ed-item.gif" alt="Edit"></a>', NULL ) CONTACT_LINK, ...
etc.
This will not display the link in any rows in which the CONTACT_STATUS is not active, i.e. "A"
-Joe -
How to prevent a text in script from displaying if its value is zero
Dear all,
How to prevent a text in script from displaying if its value is zero
for eg Price = 0.00
if price is 0 it should'nt appear in output.
I tried with if price ne 0.
price = &price&
endif.
but it's not working.
Regards
Raj
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on Jan 20, 2009 8:59 AMHello Nagaraju,
What you were doing is partially right.
The correct format to write in the script is as follows :
/: if &PRICE& ne 0.
&PRICE&
/: endif.
This should work. Let me know how it goes.
Nayan -
How to display the value of a column in a chart at the top of each column
How to display the value of each column in a chart at the top of each column?
Like this?
Done using chart Inspector.
For details, see Chapter 7, Creating Charts from Numerical Data in the Numbers '09 User Guide. The guide may be downloaded via the Help menu in Numbers.
Regards,
Barry
Maybe you are looking for
-
I received a suspicious email from From: This sender is DomainKeys verified "Mozilla Firefox" <[email protected]> Is this real? Automatic page updates causing problems with your screen reader? <pre><nowiki> 1 Mail AT&T New features! Thursday, Apr
-
My daughter's ipod touch is password locked and attached to a computer that doesnt exist anymore. i want to authorize it to my computer itunes account but itunes wont even read it due to the password failure. what can i do?
-
Display refuses to wake from sleep; restarts on its own or needs a restart
I'm having this issue since 10.9.3 over the past couple (Mac Pro Early 2009 with Apple LED Cinema Display). The screen goes black at the end of the screen saver and into sleep mode. It sometimes restarts on its own and generates a 'This machine resta
-
Hello, i have to put in as a source a tab delimited file - can nothing do about it, because our report generates it this way. So I have no idea, how to enter kind of \t into the file component delimiter tab. I can enter some 1 char things like ",", "
-
Contacts created on iPhone won't sync with exchange, only via USB
When I create a new contact on my iPhone from within the phone app, it doesn't get synced to my exchange server, in fact it doesn't show up anywhere in the contacts app or under contacts in the phone app. If I create a new contact from the contacts a