Dynamically Add Report Parameters & Get Row Count
In out Portal reports, we are inserting records into our own logging tables at the beginning of the report and updating the record at the end of the report. Currently, the sequential key has been added as a parameter so that we can access it through-out the report execution. Therefore, it displays on the parameter screen. We don't want the users to see this item. Is it possible to add it to the parameter list without having it display on the screen? Can this be done using a procedure in wwv_standard_util? Any other suggestions?
Also, we need to get the total row count of the query. Where can we get this value?
null
In out Portal reports, we are inserting records into our own logging tables at the beginning of the report and updating the record at the end of the report. Currently, the sequential key has been added as a parameter so that we can access it through-out the report execution. Therefore, it displays on the parameter screen. We don't want the users to see this item. Is it possible to add it to the parameter list without having it display on the screen? Can this be done using a procedure in wwv_standard_util? Any other suggestions?
Also, we need to get the total row count of the query. Where can we get this value?
null
Similar Messages
-
GETTING ROW COUNTS OF ALL TABLES AT A TIME
Is there any column in any Data dictionary table which gives the row counts for particular table..
My scenario is...i need to get row counts of some 100 tables in our database...
instead of doing select count(*) for each table....is there any way i can do it?
similary How to get column counts for each table..in database .For example
Employee table has 3 columns...empid,empname,deptno....i want count(empid),
count(empname),count(deptno) ...is there any easy way for finding all column counts of each table in data base? is it possible?Why does "select count(mgr) from emp" return null and not 13?Good question ;)
Seems that xml generation in principle can't handle »counting nulls«:
SQL> select xmltype(cursor(select null c from dual)) x from dual
X
<?xml version="1.0"?>
<ROWSET>
<ROW>
</ROW>
</ROWSET>
1 row selected.
SQL> select cursor(select count(null) c from dual) x from dual
Cur
0
1 row selected.
SQL> select xmltype(cursor(select count(null) c from dual)) x from dual
select xmltype(cursor(select count(null) c from dual)) x from dual
Error at line 1
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00229: input source is empty
Error at line 0
ORA-06512: at "SYS.XMLTYPE", line 0
ORA-06512: at line 1
but
SQL> select xmltype(cursor(select count(1) c from dual)) x from dual
X
<?xml version="1.0"?>
<ROWSET>
<ROW>
<C>1</C>
</ROW>
</ROWSET>
1 row selected.Looks like a bug to me ... -
Trying to get row counts for all tables at a time
Hi,
i am trying to get row counts in database at a time with below query but i am getting error:
its giving me ora-19202 error..please advise me
select
table_name,
to_number(
extractvalue(
xmltype(dbms_xmlgen.getxml('select count(*) c from '||table_name))
,'/ROWSET/ROW/C')
count
from all_tables;ALL_TABLES returns tables/views current user has access to. These tables/views are owned not just by current user. However your code
dbms_xmlgen.getxml('select count(*) c from '||table_name)does not specify who the owner is. You need to change it to:
dbms_xmlgen.getxml('select count(*) c from '||owner || '.' || table_name)However, it still will not work. Why? As I said, ALL_TABLES returns tables/views current user has access to. Any type of access, not just SELECT. So if current user is, for example, granted nothing but UPDATE on some table the above select will fail. You would have to filter ALL_TABLES through ALL_SYS_PRIVS, ALL_ROLE_PRIVS, ALL_TAB_PRIVS and PUBLIC to get list of tables current user can select from. For example, code below does it for tables/views owned by current user and tables/views current user is explicitly granted SELECT:
select
t.owner,
t.table_name,
to_number(
extractvalue(
xmltype(dbms_xmlgen.getxml('select count(*) c from '||t.owner || '.' || t.table_name))
,'/ROWSET/ROW/C')
count
from all_tables t,user_tab_privs p
where t.owner = p.owner
and t.table_name = p.table_name
and privilege = 'SELECT'
union all
select
user,
t.table_name,
to_number(
extractvalue(
xmltype(dbms_xmlgen.getxml('select count(*) c from '||t.table_name))
,'/ROWSET/ROW/C')
count
from user_tables t
OWNER TABLE_NAME COUNT
SCOTT DEPT 4
U1 QAQA 0
U1 TBL 0
U1 EMP 1
SQL> SY. -
How to get row count(*) for each table that matches a pattern
I have the following query that returns all tables that match a pattern (tablename_ and then 4 digits). I also want to return the row counts for these tables.
Currently a single column is returned: tablename. I want to add the column RowCount.
DECLARE @SQLCommand nvarchar(4000)
DECLARE @TableName varchar(128)
SET @TableName = 'ods_TTstat_master' --<<<<<< change this to a table name
SET @SQLCommand = 'SELECT [name] as zhistTables FROM dbo.sysobjects WHERE name like ''%' + @TableName + '%'' and objectproperty(id,N''IsUserTable'')=1 ORDER BY name DESC'
EXEC sp_executesql @SQLCommandThe like operator requires a string operand.
http://msdn.microsoft.com/en-us/library/ms179859.aspx
Example:
DECLARE @Like varchar(50) = '%frame%';
SELECT * FROM Production.Product WHERE Name like @Like;
-- (79 row(s) affected)
For variable use, apply dynamic SQL:
http://www.sqlusa.com/bestpractices/datetimeconversion/
Rows count all tables:
http://www.sqlusa.com/bestpractices2005/alltablesrowcount/
Kalman Toth Database & OLAP Architect
SQL Server 2014 Design & Programming
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
Get row count for different tables to the same line
How can I get the row count for different tables in one line:
SELECT count(A), count(B), count(C) from table tb_a A , tb_b B, tb_c C;
Thanks!>
Hi,
How can I get the row count for different tables in one line:
SELECT count(A), count(B), count(C) from table tb_a A , tb_b B, tb_c C;Something like this? One of the many uses for CTE's - Common Table Expressions - AKA
subquery refactoring. Worth getting to know - very handy!
with acount as
select count(*) as counta from dual -- put your table name here
bcount as
select count(*) as countb from dual -- put your table name here
ccount as
select count(*) as countc from dual -- put your table name here
select a.counta, b.countb, c.countc from acount a, bcount b, ccount c;HTH,
Paul...
Edited by: Paulie on 25-Jul-2012 17:44 -
CRVS2010 beta - Cannot add report parameters through code
Hello,
I've been trying to follow random examples from these forums of people adding a parameter to their report. My situation is as follows:
I have a report that is populated from values selected from a SQL stored procedure. In a simple test program, I'm able to display the report fine, except that when I run the app, it always asks me for the input parameter for the stored procedure. I need to set this "programmatically", and I can't seem to get it to work. Here is what I have:
ReportDocument reportDoc = new ReportDocument();
reportDoc.Load(String.Format("{0}\\ZGpQuoteReport.rpt", Environment.CurrentDirectory.ToString()));
reportDoc.SetDatabaseLogon("reportuser", "reportuser");
ParameterField quoteParam = new ParameterField();
ParameterFields reportParams = new ParameterFields();
ParameterDiscreteValue quoteVal = new ParameterDiscreteValue();
quoteParam.Name = "@QuoteNumber";
quoteVal.Value = "QGPET000000001";
quoteParam.CurrentValues.Add(quoteVal);
reportParams.Add(quoteParam);
reportViewer.ViewerCore.ParameterFieldInfo = reportParams;
reportViewer.ViewerCore.ReportSource = reportDoc;
Like I said, every time I run this code, I'm still prompted to input the parameter. Please help. Thank you!Hello - I'm having the same problem.
I had a crystal report that was working fine in VS2008. I've now got the latest VS2010 version and started using VS2010 to edit the crystal reports.
As soon as click save in VS2010 in my report, I get prompted to upgrade the report to the new file format.
From now on, whenever I run the report the user gets prompted for parameter values even though they are set in the code.
I set them using
crReportDocument.SetParameterValue("MyParameter", "value");
In the popup to edit a parameter, it says 'Show on (Viewer) Panel' which is set to 'Do not show', and 'Prompt With Description Only' is 'False'.
Is there something else I'm missing here? I need to effectively turn off offering the user to replace the parameter values.
thanks in advance, look forward to hearing from you! -
Getting row count of file into table column
Hi experts,
I want to insert the row count of the file into a table column for generating a summary file containing the detials of all the files generated for the day along with the row count and also for audit purpose.
My design is to create table in the summary file format & update the data's in it then using OdiSqlUnload to generate the required summary file, for this purpose I need to insert the row count of the file generated.
I tried to get the row count using the http://odiexperts.com/get-file-length-and-header-in-operator post. But passing the "lines" value into a ODI variable or inserting into a table column is not working.
Please help or suggest what can be done to achive the above scenario.
Thanks in advance.There are a few excellent examples at :- COUNT
Cheers
John
http://john-goodwin.blogspot.com/ -
Hi all
my requirement is
Get the count of rows returned by the query and if the number exceeds 500 display a warning .
below is my code in process form request
I have put the below code at the end of the Process form request
OAViewObject getrowcountVO = (OAViewObject) am.findViewObject("TrackingVO");
if (getrowcountVO.getRowCount() >= 500)
OAException message1 = new OAException("Row Count Exceeds 500."+" "+getrowcountVO.getRowCount(),OAException.WARNING);
pageContext.putDialogMessage(message1);
else
OAException message4 = new OAException("Row Count does not Exceeds 500."+" "+getrowcountVO.getRowCount(),OAException.WARNING);
pageContext.putDialogMessage(message4);
I am not getting the desired results.
When i run the query for filters i have on my page I get the message Row Count Exceeds 500. irrespective of the number of records shown on the page(85 currently)
Basically i get the message depending on the last queried result not the current one
Please help me
ThanksHi Modify ur code like this
OAViewObject getrowcountVO = (OAViewObject) am.findViewObject("TrackingVO");
getrowcountVO.last();
int iRowCount = getrowcountVO.getFetchedRowCount();
if (giRowCount >= 500)
OAException message1 = new OAException("Row Count Exceeds 500."+" "+getrowcountVO.getRowCount(),OAException.WARNING);
pageContext.putDialogMessage(message1);
else
OAException message4 = new OAException("Row Count does not Exceeds 500."+" "+getrowcountVO.getRowCount(),OAException.WARNING);
pageContext.putDialogMessage(message4);
Thanks
Pratap -
Most efficient way to get row count with a where clause
Have not found a definitive answer on how to do this. Is there a better way to get a row count from a large table that needs to satisfy a where clause like so:
SELECT COUNT(*) FROM BigTable WHERE TypeName = 'ABC'
I have seen several posts suggesting something like
SELECT COUNT(*) FROM BigTable(NOLOCK);
and
selectOBJECT_NAME(object_id),row_count from sys.dm_db_partition_stats
whereOBJECT_NAME(object_id)='BigTable'but I need the row count that satisfies my where clause (i.e.: WHERE TypeName = 'ABC')It needs index to improve the performance.
- create index on typename column
- create a indexed view to do the count in advance
-partition on type name (although it's unlikely) then get count from the system tables...
all those 3 solutions are about indexing.
Regards
John Huang, MVP-SQL, MCM-SQL, http://www.sqlnotes.info -
is there any other way than select count(*) from tableName to get the number of rows in a table or to know if the table has any records or not ?
Thanks !To get an exact count? No, that's the only way.
If you're using the cost-based optimizer (CBO) and your statistics are up to date and you can tolerate an estimate, you could query the NUM_ROWS column of DBA_/USER_/ALL_TABLES for the table in question.
Justin -
How to get row count of a sql query
After firing a query, how can i get the number of records returned by the query from the database, it should be database indipendent.
Statement stmt = conn.createStatement();
stmt.executeQuery(query);After this I want the number of row i.e. the number of records returned by the database.Number of rows in a ResultSet may be obtained with:
ResultSet rs;
int numRows=rs.last().getRow();
I would have said this too, as a matter of fact I mentioned scrollable result sets in my post, but as I said, not all drivers support this, and he said he needed it to be database independent, so this method should not be used. -
WCS report to get client count history
Hello! I've been poking around the Reports feature of our WCS Controller (version 7.0.164.0) and I'm trying to figure out how to get a history of the number associated clients on a particular AP over a specific date range. Is this possible? Thanks!
Christopher,
Check out this link: http://www.cisco.com/en/US/docs/wireless/wcs/7.0/configuration/guide/7_0reps.html#wp1135255
Try running the report called AP by Floor Area.
Is this what you are looking for?
Justin -
Can we get row counts when using dbms_datapump?
When using dbms_datapump, is there a way to get the rows loaded for each table, similar to the log files when using the command line? I can't seem to find anything. I'm trying to import. Database is 10g r2.
if you don't have to use DBMS_DATAPUMP and can use external tables for the import (both work exactly same way), then you can use ROWCOUNT
INSERT INTO MYTABLE SELECT * FROM EXTERNALTABLE;
v_number_of_rows := SQL%ROWCOUNT ;
COMMIT;
if you have to use DBMS_DATAPUMP then look at "worker status types" in this document
http://www.stanford.edu/dept/itss/docs/oracle/10gR2/appdev.102/b14258/d_datpmp.htm#i997417 -
Next/Prev in Report row counter
How do you have the Next/Prev selectors appear with the row counter section at the bottom of reports.
I created an SQL report, and although I selected use report pagination, the Next/Prev selectors are missing at the bottom of the report with the row counter.
If I manually create an Next/Prev process, this build buttons outside the report row counter in the report region. Since all my other reports have the selectors inside the report with the counters, it looks goofy to sudddenly have Next/Prev buttons outside the report.
ThanksKevin,
Edit the report's attributes and verify that pagination is indeed turned on. Also, are you using HTML DB 1.6?
Sergio -
Report.Services 2008 - get page-count or row-count in the c#-code
hello
is it possible to get from the ReportViewer-control / ServerReport the page-count or row-count after the
reportViewerCheck.ServerReport.Refresh();
statement ??
many thanks in advance for any clue & regards
MichaelHi Michael,
Yes, you can get them. For row count, you can add a parameter to store the row count of your dataset in your report.
Here are the steps:
1. Add 2 datasets in your report, one for report use and the other on is to row count use. For instance:
DataSet1: SELECT HumanResources.vEmployee.* FROM HumanResources.vEmployee
DataSet2: SELECT COUNT(*) FROM HumanResources.vEmployee
2. Add a parameter, set the parameter’s default value set to Get Values from a query and select DataSet2.
Then, in your ASP.NET web application code you can use the following function to get the row count of the report:
private int GetReportRowCount(ReportViewer report)
return Convert.ToInt32(report.ServerReport.GetParameters()[0].Values[0].ToString());
For page count, you can refer to the following code:
private int GetReportPageCount(ReportViewer report)
return report.ServerReport.GetTotalPages();
You may not get the correct row count and page count in after executing Refresh () method, that’s because when you run this method, it will start another thread to refresh the report and the code below Refresh () method will not wait refreshing complete but run it. For instance, you may get the page count as o if you run the following code in the Button event:
// Click this Button to refresh the ReportViewer1
protected void btnGetPageCount_Click(object sender, EventArgs e)
// Refresh the ReportViewer1
this.ReportViewer1.ServerReport.Refresh();
// Get ReportViewer1's page count and display in the txtPageCount TextBox
this.txtPageCount.Text = this.ReportViewer1.ServerReport.GetTotalPages().ToString();
You can run the refresh in separate events and get page count in another event, such as below code:
// Click this Button to refresh the ReportViewer1
protected void btnGetPageCount_Click(object sender, EventArgs e)
// Refresh the ReportViewer1
this.ReportViewer1.ServerReport.Refresh();
// Display the txtPageCount's text to ReportViewer's page count
protected void btnGetPageCount2_Click(object sender, EventArgs e)
// Get ReportViewer1's page count and display in the txtPageCount TextBox
this.txtPageCount.Text = this.ReportViewer1.ServerReport.GetTotalPages().ToString();
Hope this helps! I would suggest you post a new thread in Visual Studio Report Controls forum if you need more help about using ReportViewer in ASP.NET web application.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Maybe you are looking for
-
Upgrading from Mac OS X 10.4.11 to use Hyperlapse.
I have been advised that I need to upgrade to at least OS X 10.6 in order to access Hyperlapse. I am keen to do this as I also realise that things have moved on since and I perhaps ought to upgrade in any case. My questions are these: Will I still be
-
How do I get an invoice for an App Store purchase?
I bought Lion when it first came out, and now need an invoice, but I can't find an email, and can't figure out how to get the App store to produce one - it has a record that I purchased it but no price. Help? Thanks!
-
Dear Experts, Can you advise how we can set oracle trace ON for a given session/piece of code. Actually we have a datawarehouse which is populated overnight Mon-Sun. One of the procedures in this load is failing with the error ORA-8103 object no long
-
Error meaggage when trying to listen to a book in my Itunes library
I have 2 Windows 7 computers. I have a book on one of them and tried to transfer it to the other one through Home sharing. It appeared to work. It shows up in my playlist of the computer I am transferring the book to. When I double click on the b
-
All, I am doing some research on integrating struts framework with jsr168 framework. The reason for this is I do not put all the logic in the processAction method of the Portlet and I wanted to leverage the struts framework. In struts the starting po