How do i suppress a section with a formula if a sql query result is 0
hello everyone,
i want to supress a section if a query result is 0. Is there a tutorial somewhere how to do that?
thank you all,
joshua
Hi,
Crystal needs to know what the record count is. In our reports, we have a message that comes up when the record count is 0.
In the Section Expert, select the section you want suppressed. Put a check beside Suppress (No Drill-Down). In the Conditional formula your formula would look like:
Count ({table.FIELD1}) = 0;
This will suppress that section if no records are returned.
Good luck,
Brian
Similar Messages
-
How do I insert a section with another time signature than the one im inser
How do I insert a section with another time signature than the one im inser
Yeah I've been trying to figure this out as well, for example... my song might be 90 bpm and I want to program another track using midi but have it play at 180 bpm. The only way I've found to work around this is to write my 180 bpm part make a sample of this and then loop this into the 90 bpm song.
-
1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed in the stat plan ?
2. Does rowsource statistics gives some kind of understanding of Extended stats ?You can get Row Source Statistics only *after* the SQL has been executed. An Explain Plan midway cannot give you row source statistics.
To get row source statistics either set STATISTICS_LEVEL='ALL' in the session that executes theSQL OR use the Hint "gather_plan_statistics" in the SQL being executed.
Then use dbms_xplan.display_cursor
Hemant K Chitale -
Suppressing sub-section with drill down OK
This may be an easy one that I just cannot figure out (I hope...).
I have created two details sections - details A and details B. I would like to suppress details section B while still allowing for drill down capabilities. However, that option is not available. I can either suppress the entire details section (A and B) with drill down capabilities or suppress either A OR B with no drill down capabilities.
Any and all help would be truly appreciated!!I can only think of using an on demand subreport which sits in Details b. but the row and the SR lable will be visible for all records.
Ian -
How can I replace column value with a particular value in SQL
Hi All,
Can anyone please tell me how can I format my output with replacing a column value with a specific value which actually depends on the present value of the column
I am executing the following SQL statement
select state,count(id) from <table_name> where composite_dn= <composite_dn_name> group by state;
My Present output is:
State No.Of Instance
1 3
3 28
I want to replace the value in the column state as follows
State No.OfInstances
Completed 3
Faulted 28
I want "1" to be reppaced by "Completed" and "3" to be replaced by "Faulted"
Is is possible with SQL or PL/SQL , if it is then how can I achieve this required result. Please help!!
Thanks in Advance!!
Edited by: Roshni Shankar on Oct 27, 2012 12:38 AMHi Roshni,
I guess this CASE clause can be simulated by a DECODE and also it is very easy to use.
Refer -- http://www.techonthenet.com/oracle/functions/decode.php
select decode(t1.state,t2.state_id,t2.state_name), t1.count_id
from <table_2> t2, (select state,count(id) count_id
from <table_name>
where composite_dn= <composite_dn_name>
group by state) t1
where t1.state = t2.state_id;HTH
Ranit B.
Edited by: ranit B on Oct 27, 2012 2:02 PM
-- link added
Edited by: ranit B on Oct 27, 2012 2:19 PM
-- sample code added -
How do you obtain SEQ_ID of a collection based on a SQL QUERY
I don't know if my brain is not working or what, but how can I access the seq_id of a collection that I display as a SQL Query? I have this SQL Query:
select
htmldb_item.checkbox(1,b.asset_id) " ",
htmldb_item.select_list_from_lov(2,
'SHARE-UNRESTRICTED','LOV_RESERVATION_MODE',null,'YES') "mode",
a.seq_id,
b.asset_no,
b.device_name,
b.device_name_attached_to
from
htmldb_collections a,
asset_report_vw b
where
a.collection_name = 'CART'
and a.c001 = b.asset_id
The user can select the reservation mode from the select list for the Mode field and hit a button to update the cart. I have reviewed documentation and the Collections Showcase demo that showed how to do this with form items, but not from a report. I can't figure out how to get the seq_id to pass to the HTMLDB_COLLECTION.UPDATE_MEMBER_ATTRIBUTE procedure. I tried to create a hidden region item called P9_SEQID but I can't figure out how to set it to the seq_id returned from a query. Using #SEQ_ID# syntax doesn't work.I am including the seq_id in my SQL Query report. The sticky point was how to reference the seq_id in an AFTER SUBMIT process to update the collection returned by the SQL Query when the user hit the Apply Changes button (they can edit one of the fields).
So, I assume then this is how I need to do it. I thought there might be a more efficient way to do it by somehow referencing the seq_id column in the SQL Query report instead of having to requery to get the seq id for each row in the SQL Query:
-- 'update_cart' AFTER SUBMIT process
DECLARE
v_seqid number := null;
BEGIN
FOR I in 1..HTMLDB_APPLICATION.G_F02.COUNT LOOP
select x.seq_id into v_seqid from htmldb_collections x
where x.collection_name = 'CART'
and c001 = htmldb_application.g_f01(i);
HTMLDB_COLLECTION.UPDATE_MEMBER_ATTRIBUTE(
p_collection_name => 'CART',
p_seq => v_seq_id
p_attr_number => 2,
p_attr_value => htmldb_application.g_f02(i));
END LOOP;
END; -
How to pass a string value from XL sheet cell to SQL query.
Hi,
I am using SQL query in XL sheet to fetch some data. for that i am using ODBC connection. Now I want to pass a string from XL sheet Cell value in the where clause of Select statement, Please let me know how to do this.
Below is My code:
nge("A4").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DRIVER={Microsoft ODBC for Oracle};UID=xyz;PWD=xyz;SERVER=xyz;" _
, Destination:=Range("A4"))
.CommandText = Array( _
"SELECT CRYSTAL_REPORT1.PROJECT, CRYSTAL_REPORT1.OBJECT" & Chr(13) & "" & Chr(10) & "FROM NAIODEV.CRYSTAL_REPORT1 CRYSTAL_REPORT1" _
.Name = "Query from gg"
Thanks,
PriyaWhat does "XL" (whatever that is) have to do with Crystal Reports which is what you are obviously working with have to do with the Oracle database?
The rules for using Crystal with Oracle are quite clearly described in all the Crystal Reports docs ... you MUST use IN OUT ref cursors unless you are doing direct table or view access. -
How to dynamically update columns in a where clause to a SQL query in OSB?
Hi Gurus,
I have a requirement where in we need to dynamically update a where clause to a SQL query in OSB(11.1.1.6.0).
For example:
If the JCA sql string is "select * from emp where emp_id = 100 and emp_status ='Permanent'" now i want to change this where clause and the new query has to be like "select * from emp where emp_name like 'S%' and emp_dept like 'IT' ". basically we need to change the where clause dynamically.
We can also use "fn-bea:execute-sql()" in a xquery but I don't want to use this function as creates a new connection.
I have done some home work and found out --> as per the DOC "http://docs.oracle.com/cd/E23943_01/dev.1111/e15866/jca.htm#OSBDV943" section: "25.5.2 JCA Transport Configuration for Proxy and Business Services", when a business service is created by using JCA, we can see Interaction Spec Properties under JCA Transport Tab. This will have a property "SqlString' and we can over ride it. But I am unable to figure out how to over ride the value. I have tried by using Transport Headers activity but no luck. Please guide me how to achieve this?
Thanks in advance
SuryaI solved my problem.
In my header renderer, I simply added a line to set the text to the object value "label.setText( (String) value );" (where label is an instance of a JLabel.
Thank you to who took some time to think about it.
Marc -
How to use SQL query result in DOS commands
Hi
Currently i am runnig below DOS commands manually
d:\apps\bin>TrueGridsCalc period="Aug 2010"
Now I want to write one batch file and schedule job on windows and make value of "period" to be dynamic. So to get that value i need to fetch it from DB
Steps which i am taking are
1. connect DB from command line (using SQLPLUS)
2. run query to fetch result
3.How to use query result in "period" parameter ?
I am good at step 1 and 2. Dnt know how to use query result in command to make it dynamic
Thank you
Sachin
Edited by: sachin.mali on Oct 26, 2010 4:39 PM
Edited by: sachin.mali on Oct 26, 2010 4:43 PMsachin.mali wrote:
Hi
Currently i am runnig below DOS commands manually
d:\apps\bin>TrueGridsCalc period="Aug 2010"
Now I want to write one batch file and schedule job on windows and make value of "period" to be dynamic. So to get that value i need to fetch it from DB
Steps which i am taking are
1. connect DB from command line (using SQLPLUS)
2. run query to fetch result
3.How to use query result in "period" parameter ?
I am good at step 1 and 2. Dnt know how to use query result in command to make it dynamic
Thank you
Sachin
Edited by: sachin.mali on Oct 26, 2010 4:39 PM
Edited by: sachin.mali on Oct 26, 2010 4:43 PMYOu'll have to have sqlplus spool the output to a file, then figure out some way of parsing that file. Too bad you're stuck with Windows. With any *nix you could do the file parsing with one line of code. -
SQL Subscription field shows * only with Dynamic Text Label in SQL query
We are using Hyperion Analyzer 7.2.x for showing budget and actual data. I have to show this financial data based on the security e.g. person in IT can see only IT dept. data. Hence I want to use dynamic text label <<userid>> for the security based on the person logging in to Analyzer.
But when I use dynamic text label <<userid>> in the SQL query in SQL Spreadsheet, SQL Subscription field shows * only selection option. Does anyone have idea how to solve this problem?
Thanks in advance for your help.
-SVHi
Okay i know this is a bit crazy way.....but i think this is the solution for your issue.
Create a report without the where clause (<<useris>>) then add a filter (sql subscription) then you can find all the values that are there in the SQL field (try to increase the query limit it is set to 250 as default) then edit the spreadsheet and add the where clause (<<userid>>).
This will help you having the filter and the dynamic text label. I think there is an issue when you try to filter it with a where clause.
Hope it helps.
CK -
How to get an sql query result to a textbox?
i am working with jdk1.4 and office 2003.
i need to run the following SQL Query: "SELECT max(BookId) as BookId FROM Books" where BookId is an autonumeric generated number obtained from the field autonumber in access 2003 database.
now, the result of this must be placed in a textbox.
does anyone knows how to do this?
I ve tried this but nothing happens and niether any error comes
st = con.createStatement (); //Creating Statement Object.
long bookNo; //Use for Comparing the Book's Id.
try { //SELECT Query to Retrieved the Record.
String q = "SELECT max(BookId) as BookId FROM Books";
ResultSet rs = st.executeQuery (q); //Executing the Query.
bookNo = rs.getLong ("BookId"); //Storing the Record.
bookNo =(bookNo+1);
txtBookId.setText (""+bookNo);
catch (SQLException sqlex) { }
does anyone knows how to do this?????plz help me out.
Thanks
AanchalHi Aanchal,
If an SQL error occurs now, you cannot see it in your code. You should do something with the exception you catch, e.g. printing it: sqlex.printStackTrace(), so that you can see if something goes wrong.
For your number, you should move the cursor in the resultset to the first row - either by: calling first( ) or next ( ), then you can retrieve your booknumber.
Best Regards,
Martijn -
Text area with html editor based on sql query
Hi all,
I am trying to create a text area with its contents loaded from a sql query returning a blob field.
I gave the query
select blob_field from file_subjects where id=41; in the item source valueI am getting an error in the display page like
ORA-00932: inconsistent datatypes: expected NUMBER got BLOB
Error ERR-1019 Error computing item default value: page=5 name=CONTENTS.
where am i goig wrong..?
should i go for a pl/sql instead?Venket,
See my previous thread on this (Well I used CLOB rather than BLOB). You will find code examples too. Should be just what you need.
How to "Bypass" HTMLDB
-Joe -
SQL query result with HTML Data in output
Hello,
I have a SQL table , in one column I store HTML data. I need to query the table and get the HTML data in the columns that have 'HREF'. The output shows as grid on the sql management studio, however when I export it to excel, the HTML data does not get copied
correctly, since there are HTML tags etc.
How can I export the report correctly from SQL ?Hello,
The HTML data is stored in a column with datatype as nvarchar(max). Sample data in the column is shown below. It is with formatting etc and is rendered as is on the web page. the business wants to generate a quick report so that they can see the pages that
have links displayed. I can do that by querying the columns that have a 'HREF' in the text.
Can I get the exact HREF values using just sql query? There can be more than one links on a page.
Also, If I just want to copy the whole column and paste it on excel, how can I do that? If I copy the data below and paste, it does not get copied in one cell.. it spreads across multiple cells, so the report does not make any sense.
<br />
<table border="0" cellpadding="0" cellspacing="0" style="width: 431pt; border-collapse: collapse;" width="574">
<tbody>
<tr height="19" style="height: 14.25pt; ">
<td height="19" style="border: 0px blue; width: 431pt; height: 14.25pt; background-color: transparent;" width="574"><a href="https:"><u><font color="#0066cc" face="Calibri">ax </font></u></a></td>
</tr>
</tbody>
<colgroup>
<col style="width: 431pt; " width="574" />
</colgroup>
</table> -
How to send SQL query results to XML ?
Hey Guys, I am querying a DB with huge amount of traffic. A user select a particular lot and then details of the lot will be displayed in the following page. My concern here is that it takes really LONG to retrieve back the results coz it has to requiry in the following JSP page.
I was told to use XML to retrieve the dataset and store it. Hence, in the following query it will re-query only from the recordsets in the XML file (...Logically, should be faster rite ? ). Hence, how do parse my recordsets retrieved from the SQL query to an XML file ?
Any sort of suggestion , help, reference would be deeply appreciated ..Thanks !<HTML>
<BODY>
<H1>Manufacturing Summary beta </H1><BR>
<%@ page import="java.sql.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.text.*" %>
<jsp:include page="/index.html" flush="true"/>
<P><B>Returned result<B><BR>
<B>Query String :</B><%=request.getParameter("date") %>
<TABLE BORDER=1 cellpadding=0 cellspacing=0>
<%!
static double roundDouble(double toBeRounded, int fractionDigits)
NumberFormat format = NumberFormat.getInstance();
format.setMaximumFractionDigits(fractionDigits);
String tempDouble = format.format(toBeRounded);
return Double.parseDouble(tempDouble);
%>
<%
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@klmomnidb:1521:
OMNIDB","omni","omni");
Statement stmt = null;
ResultSet rset = null;
String S_date = new String();
String temp = new String();
String lot_id = new String();
String result = new String();
String SQL_String = new String();
double yield;
int bad_cnt;
S_date = request.getParameter("date");
lot_id = request.getParameter("lot_id");
temp = request.getParameter("TST_TEMP");
SQL_String = "SELECT LOT_ID, FLOW_ID, TST_TEMP, MODE_COD, RTST_COD, PART_CNT, GO
OD_CNT, OPER_NAM, JOB_REV, PROC_ID, START_T, FACIL_ID, TSTR_TYP, NODE_NAM FROM L
OT where START_T > TO_DATE('"+ S_date + "','MM/DD/YYYY') AND TST_TEMP <='" + tem
p+"' order by START_T";
out.println(SQL_String);
stmt = conn.createStatement();
rset = stmt.executeQuery (SQL_String);
out.println("<TR>");
out.println("<TD> Select Lot(s)</TD>");
out.println("<TD>Flow </TD>");
out.println("<TD>Temp </TD>");
out.println("<TD>Test Mode </TD>");
out.println("<TD>Retest</TD>");
out.println("<TD>Total </TD>");
out.println("<TD>Good</TD>");
out.println("<TD>Bad</TD>");
out.println("<TD>Yield </TD>");
out.println("<TD>UserID</TD>");
out.println("<TD>Program</TD>");
out.println("<TD>Mask</TD>");
out.println("<TD>Start Time </TD>");
out.println("<TD>Loc </TD>");
out.println("<TD>Tester</TD>");
out.println("<TD>System </TD>");
out.println("</TR>");
if (! rset.next()) {
result ="No records found matching seach criteria.";
while (rset.next()) {
bad_cnt = Integer.parseInt(rset.getString(6)) - Integer.parseInt(rset.getString(
7));
yield = (Double.parseDouble(rset.getString(7)) / Double.parseDouble(rset.getStri
ng(6))) * 100;
result= "<TR>";
result = result + "<TD><a href=coolpage.jsp?LOT_ID=" + rset.getString(1)+ ">" +
rset.getString(1) + "</A></TD>";
result = result + "<TD>" + rset.getString(2) + "</TD>";
result = result + "<TD>" + rset.getString(3) + "</TD>";
result = result + "<TD>" + rset.getString(4) + "</TD>";
result = result + "<TD>" + rset.getString(5) + "</TD>";
result = result + "<TD>" + rset.getString(6) + "</TD>";
result = result + "<TD>" + rset.getString(7) + "</TD>";
result = result + "<TD>" + bad_cnt + "</TD>";
result = result + "<TD>" + roundDouble(yield,2) + "% </TD>";
result = result + "<TD>" + rset.getString(8) + "</TD>";
result = result + "<TD>" + rset.getString(9) + "</TD>";
result = result + "<TD>" + rset.getString(10) + "</TD>";
result = result + "<TD>" + rset.getString(11) + "</TD>";
result = result + "<TD>" + rset.getString(12) + "</TD>";
result = result + "<TD>" + rset.getString(13) + "</TD>";
result = result + "<TD>" + rset.getString(14) + "</TD>";
result = result + "</TR>"; %>
<%=result%>
<% }
rset.close();
stmt.close();
conn.close();
%>
<%=result%>
</TABLE>
</BODY>
</HTML> -
SQL Query Result with Random Sorting
Hi Experts,
My Oracle Version : Oracle9i
I have three tables which are given below,
Table Name: check_team
team_id team_code
100 A
101 B
102 C
103 D
Table Name: check_product
product_id product_code
1 XXX
2 XYZ
Table Name: check_team_products
tprod_id tprod_team_id tprod_product_id
1 100 1
2 100 2
3 101 1
4 101 2
5 102 1
6 102 2
7 103 1
8 103 2
Required Output First Time:
team_id team_code product_id product_code
100 A 1 XXX
101 B 2 XYZ
102 A 1 XXX
103 B 2 XYZ
Required Output Second Time:
team_id team_code product_id product_code
100 B 2 XYZ
101 A 1 XXX
102 B 2 XYZ
103 A 1 XXXI need the result as Required Output specified above and also the result has to be random too.. Can someone help me in writing a SQL Query to get results as that?
Added Oracle VersionSo, is it something like this you want?
SQL> ed
Wrote file afiedt.buf
1 with check_team as (select 100 as team_id, 'A' as team_code from dual union all
2 select 101, 'B' from dual union all
3 select 102, 'C' from dual union all
4 select 103, 'D' from dual)
5 ,check_product as (select 1 as product_id, 'XXX' as product_code from dual union all
6 select 2, 'XYZ' from dual)
7 ,check_team_products as (select 1 as tprod_id, 100 as tprod_team_id, 1 as tprod_product_id from dual union all
8 select 2, 100, 2 from dual union all
9 select 3, 101, 1 from dual union all
10 select 4, 101, 2 from dual union all
11 select 5, 102, 1 from dual union all
12 select 6, 102, 2 from dual union all
13 select 7, 103, 1 from dual union all
14 select 8, 103, 2 from dual)
15 --
16 -- end of test data
17 --
18 select team_id, team_code, product_id, product_code
19 from (
20 select t.team_id, t.team_code, p.product_id, p.product_code
21 ,row_number() over (partition by team_id order by dbms_random.random()) as rn
22 from check_team t join check_team_products tp on (tp.tprod_team_id = t.team_id)
23 join check_product p on (p.product_id = tp.tprod_product_id)
24 )
25* where rn = 1
SQL> /
TEAM_ID T PRODUCT_ID PRO
100 A 2 XYZ
101 B 1 XXX
102 C 2 XYZ
103 D 1 XXX
SQL> /
TEAM_ID T PRODUCT_ID PRO
100 A 2 XYZ
101 B 1 XXX
102 C 2 XYZ
103 D 1 XXX
SQL> /
TEAM_ID T PRODUCT_ID PRO
100 A 1 XXX
101 B 2 XYZ
102 C 1 XXX
103 D 1 XXX
Maybe you are looking for
-
Certifications not Updated in MCP site
I have cleared 4 exams in the past month (1 MCSA and 2 MCSE's), but only one of them shows in my certification planner and no updates to my certifications. I reached out to Microsoft and the said they were having "technical problems." Has anyone else
-
How to easily print out the tutorial
Is there an easy way to print out the entire tutorials that are available on the adobe site? It's easier for me to follow a tutorial on paper next to me then to open two window on my computer screens and follow on the screens. Thank you.
-
AK1 segment missing in 997 in B2B 10g
I have configured a 997 acknowledgment in B2B 10g with version 5010VICS . In reports i can see AK1 segment in xml payload while it is missing in wire messege payload.Please suggest.
-
How do you get an Avatar?
Hey! how do you put up an avatar!?
-
Aperture freezes every time I push the auto exposure button. Any suggestions?
Aperture freezes every time I push the auto exposure button. Any suggestions?