Counting grouped table rows
Hello experts.
I trying to build a model which will do the following thing:
Calling a data service (a BAPI for that matter), then grouping the data recieved, presenting it in a table and a form next to it (It can be in the table itself) showing how many rows i have for each group.
It has to be dynamically, is there a way to do it?
thank you.
>
Govindu Nagotla wrote:
> Hi,
>
> on which SP you are Working,
>
> This can be done by Grouping operator.
>
> Drag a Group operator from Compose Panel and Add the group operator to the output port of ur data service.
>
> Then Configure the group operator in the way you want.
>
> If did not get you get back to me.
>
> Regards,
> Govindu
Hi Govindu.
Sorry, I forgot to mention it, I'm working on SP14.
and I still cant understand how the Group operator can help me. I want to count the rows of every subgroup of a group. (For example: the group is cites - How many rows for NY, How many for LA and so on).
Motty.
Similar Messages
-
How to group table rows using GroupedColumn?
Hi all,
i know by binding the grouping value to a context, it can merge rows into one. but this only works if the two rows are adjacent.
if the context looks like this:
value 1
value 2
value 1
value 2
it can not group them together
how to group them together and merge the rows?
thanks.Hi erv,
U need to use the TableSorter class for this.
You can download the TableSorter.java class from the tutorial Working with Tables in Web Dynpro.
Here you can select the project A) Creating Tables and download the Ready-to-use project. The lick to download project is:
[/docs/DOC-8061#46|/docs/DOC-8061#46]
Once you have downloaded the tutorial, you can find the TableSorter.java class in this path
TutWD_Table/src/packages/com/sap/tc/webdynpro/tests/utils
For more information refer to this blog:
[Enhanced Web Dynpro Java TableSorter for SAP NetWeaver 04s|/docs/DOC-8061#46]
Regards,
Sayan Ghosh -
I want a count of distinct rows in a table
I want a count of distinct rows in a table through a single query -- is it possible?
eg.
table-
create table ch1 (a int, b int, c int, d int)
insert ch1 values (1,1,1,1)
insert ch1 values (2,2,2,2)
insert ch1 values (1,1,1,1)
insert ch1 values (2,2,2,2)
insert ch1 values (1,3,4,5)hi,
create table ch1 (a int, b int, c int, d int) ;
insert into ch1 values (1,1,1,1);
insert into ch1 values (2,2,2,2);
insert into ch1 values (1,1,1,1);
insert into ch1 values (2,2,2,2);
insert into ch1 values (1,3,4,5);
SQL> select * from ch1;
A B C D
1 1 1 1
2 2 2 2
1 1 1 1
2 2 2 2
1 3 4 5
SQL> select distinct * from ch1;
A B C D
1 1 1 1
1 3 4 5
2 2 2 2
SQL>
1* select count(*) from( select distinct * from ch1)
SQL> /
COUNT(*)
3
SQL> ed
Wrote file afiedt.buf
1 select count(*) from (select a,b,c,d from ch1
2* group by a,b,c,d)
SQL> /
COUNT(*)
3
SQL> Thanks,
P Prakash -
Problem with checkbox group in row popin of table.
In table row popin I have kept Check Box Group.I have mapped the texts property of checkbox group to the attribute which is under the subnode of the table.the subnode properties singleton=false,selectioncardinality=0-n,and cardinality=0-n.
if there are 'n' number of records in the table.each record will have its own row popin and in the row popin there is check box group.
the check box group in the row popin belongs to that perticular row.
but the checkboxegroup values in row popins of all the rows are getting changed to the row which is lead selected.
The same scenario (table in the row popin is showing the values corresponding to its perticular row and all the table values in popin are not getting changed to the one lead selected in the main table)is working fine with the table in place of checkbox group in row popin with datasource property of table binded to the subnode
I cant trace out the problem with checkbox group in place of table.
Please help me in this regard.I have to place check box group in place of table in row popin.
Thanks and Regards
Kiran Kumar KI have done the same thing successfully with normal check box ui element. Try using check box in your tabel cell editor instead of check box group.
-
Grouping of rows of internal table.
Hi all,
I am having a requirement in which I want to group two rows of an internal table and assign a pointer to the two rows.
This pointer variable will then be passed to ALV.
Help reqd.
regards.hi,
AT - itab:
push F1 to look at the documentation for grouping
then assign the value to a field-symbol. -
Procudure to count all the rows in a all tables in the schema
When I run the following store procedure to count all the rows in all the tables I crash my sql Plus editor:
CREATE OR REPLACE PROCEDURE TC_TABLEROWCOUNT(OWNER IN varchar2)
IS
row_count number;
cursor get_tab is
select table_name, num_rows
from all_tables
where owner='MAXDEV';
begin
dbms_output.put_line('Checking Record Counts for schema maxdev ');
FOR get_tab_rec IN get_tab LOOP
BEGIN
EXECUTE IMMEDIATE 'select count(*) from '||get_tab_rec.table_name
INTO row_count;
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line('Error counting rows for table '
||get_tab_rec.table_name);
END;
END LOOP;
END;
What am I doing wrong.
Thanks for any help TonyThe boss gave me 5 pages of tables and wants to know how many row there are in each table. There is a problem of one DB being out of sync with another.
But I have managed to work the problem though.
here is the working code:
CREATE OR REPLACE PROCEDURE TC_TABLEROWCOUNT (
TableOwner IN varchar2)
IS
row_count number;
vTable varchar2(30);
v_sqlstmt varchar2(100);
cursor get_tab is
select table_name, num_rows
from all_tables
where owner = TableOwner;
begin
dbms_output.put_line('Checking Record Counts for schema maxdev ');
FOR get_tab_rec IN get_tab LOOP
vTable := get_tab_rec.table_name;
v_sqlstmt := 'SELECT count(*) from '||vTable;
EXECUTE IMMEDIATE v_sqlstmt into row_count;
dbms_output.put_line('Table '|| get_tab_rec.table_name || ' Row ' || row_count);
END LOOP;
END; -
Count of records/rows in a Table
Hi
This could be a basic question , but i don't have an idea how to do that .
Could you please tell me , how get an count of records/rows in a specific table ?
Thank you
Lukesb92075 wrote:
It takes time to get count of records if the table size is hugCan YOU count to 1000000000000000000 as quickly as you count to 10?????????????????????????
If it takes you longer to count many things, why do you expect Oracle to do better than you?Really??
Let's try some counts and see.
First off, let's count a few 1000 rows.
SQL> set timing on
SQL> select count(*) from all_objects;
COUNT(*)
45045
Elapsed: 00:00:17.08So 17 seconds for 45,000 rows.
Now if you're logic is correct, counting let's say a few billion rows, should take an hour? Perhaps more?
Here's what I see on one of my larger tables:
SQL> select count(*) from daily_xxxxxxx;
COUNT(*)
2569780329
Elapsed: 00:00:10.03Oops... it is faster.
Get a clue!I hereby sincerely apologise that my database does not adhere to your fine logic that says it should take a few hours - I will speak disapprovingly to the CBO for allowing the 2nd select count (on the same database) to be faster than the 1st select count. I will even use the backchannel to inform Larry that this is not acceptable.
Of course, this is assuming that you do not have your head stuck up somewhere and are indeed correct that it takes a "+looooonnngggg+" time to count lots of rows.
!http://smileyicons.net/smilies/actions1.gif! -
How to count number of rows in table
can I get number of row in table except Count(*) in pl/sql
is there any other wayAlso posted and answered here
how to count number of rows in table
count(*) will be the fastest way. It is only slow if the table has a vast number of rows, in which case why do you need to know the tables has 73552436467721 rows and not 73552436467737 rows. It doesn't seem to be much use. Either that or you are counting them a lot, which again seems rather pointless. -
Hi!
1. How can you through ABAP and select statements count the number of rows in one table?
2. I want to read all rows from one table to an internal table. Can this be done dynamically or do I first have to count the number of rows in the table and then declare an internal table with the number of rows counted.
regards
BaranHI,
No you don't have to count number of rows first, Internal table size will increase dynamically. you have to declare this with initial size like this.
<b>data: itab type standard table of bkpf initial size 0.
SELECT * FROM bkpf into table itab.</b>
All values from bkpf will be inserted into table internal table itab.
Regards, -
COunt no of rows of all the tables
hai
Pls tell me COunt no of rows of all the tables in the user SOP
Output like this
Tablename rows
sen 31
van 45
etc
pls help
Sset serveroutput on size 100000 feedback off
declare
rs integer;
cur integer;
rp integer;
trs integer;
n integer;
un varchar2(30);
begin
dbms_output.put_line(rpad('Table Name',40)||' Number of Rows Created Date');
dbms_output.put_line(rpad('-',73,'-'));
cur:= dbms_sql.open_cursor;
for t in (select object_name, created from dba_objects where object_type='TABLE' and OWNER='SOP') loop
dbms_sql.parse(cur,'select count(*) from SOP.' || t.object_name, dbms_sql.v7);
dbms_sql.define_column(cur, 1, rs);
rp:= dbms_sql.execute(cur);
n:=dbms_sql.fetch_rows(cur);
dbms_sql.column_value(cur, 1, rs);
dbms_output.put_line(rpad(t.object_name,48,'.')||rpad(rs,15,'.')||t.created);
end loop;
dbms_sql.close_cursor(cur);
dbms_output.put_line(rpad('-',73,'-'));
end;
set serveroutput off feedback on feedback 6
Anyway or...
set serveroutput on size 100000 feedback off
declare
rs integer;
cur integer;
rp integer;
trs integer;
n integer;
un varchar2(30);
v_user varchar2(20);
begin
v_user := '&user';
dbms_output.put_line(rpad('Table Name',40)||' Number of Rows Created Date');
dbms_output.put_line(rpad('-',73,'-'));
cur:= dbms_sql.open_cursor;
for t in (select object_name, created from dba_objects where object_type='TABLE' and OWNER=v_user) loop
dbms_sql.parse(cur,'select count(*) from '|| v_user ||'.' || t.object_name, dbms_sql.v7);
dbms_sql.define_column(cur, 1, rs);
rp:= dbms_sql.execute(cur);
n:=dbms_sql.fetch_rows(cur);
dbms_sql.column_value(cur, 1, rs);
dbms_output.put_line(rpad(t.object_name,48,'.')||rpad(rs,15,'.')||t.created);
end loop;
dbms_sql.close_cursor(cur);
dbms_output.put_line(rpad('-',73,'-'));
end;
Enter value for user: TEST
old 11: v_user := '&user';
new 11: v_user := 'TEST';
Table Name Number of Rows Created Date
TEST_UPDATE2....................................1..............21-JAN-09
TEST_UPDATE.....................................1..............20-JAN-09 -
Row/column counter for tables
Hello,
I know this is very basic, but so far examples I dug up don't really anything remotely to what I want.
I have 3 databases. Well they are defined as "connections" in SQLDeveloper I hope that's the same I am still not used to Oracle abstractions.
Each has several tables. All I want is loop through each of the 3 DBs and log row count and table count.
Say DB1:
Rows: Columns:
Table1: x y
Table2: x y
I don't really care what's inside them. I found one example that did it but it listed some system tables that aren't part of my db. Changing "owner" didn't really help.
From the value of the variable "Owner" means a database, is that correct?
Oh and I also don't care if the code is "inefficient", tables aren't that big.
Thanks in advance.
Edited by: 940349 on Jun 14, 2012 6:22 AMnot sure what you are planning to achieve, but you can use below query to get owner of table, table name , column name, number of tables by owner and number of column in a table (belonging to owner). This will require access to dba_tab_columns.
select owner,table_name,count(*) over(partition by owner) count_table,column_name,count(*) over(partition by owner,table_name) count_column from dba_tab_columns; -
hi folks,
How to get a tables' row count (number of records)?
Values of table are filled by an RFC return structure. Or how can we get the number of records in the RFC return structure?
thanks in advance
nikhilHi,
Check the size of the node bound to the table
lets say orders is the node bound to the table
//Replace orders with the node bound to your table.
wdContext.nodeOrders().size();
Regards
Ayyapparaj -
Row count for tables from 2 different databases
Hi,
i wrote a query to get counts from all the tables in one schema to another schema. this generates the select count (*) from tables and gives me the counts, but i want to get the counts such as
table1 -- 100 -- DB1
table1 - 110
table2 - 230 - DB2
table2 - 230 etc...
here is my query that works but display of the output is the way i wanted. can someone help me getting the output as above described.
select 'select ''PTO'', count(*) as '||(table_name)||'_count'||' from '||table_name||';'from dba_tables
where owner = 'TEST'
union all
select 'select ''PFO'', count(*) as '||(table_name)||'_count'||' from '||table_name||';'from [email protected]
where owner = 'TEST';
thanks...DUPLICATE post
count of rows in a schema tables -
Count not updating when counting table rows (after adding one)
following this code from this link:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/479cbc96-6ec2-4d9f-b2f8-a2b43a09111e/html-client-dynamically-count-records-in-a-collection-on-browse-screen?forum=lightswitch
I have got my screen to count how many rows are present when the screen first loads. In my scenario I have a add button located on the bottom navigation bar. this opens up a dialog window where the user can add the relevant information. However when the
user hits save, and is navigated back to the browse screen, the count still displays the previous value. If i was to refresh the page it updates but this is not what i am after, when i navigate back i want the value to add by one, am i missing something in
this code?
screen.ExpanderLines.addChangeListener("state", function() {
screen.countExp = screen.ExpanderLines.data.length;
thanks for any helpTry this:
screen.ExpanderLines.addChangeListener("count", function () {
screen.countExp = screen.ExpanderLines.count;
Dave
Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer. -
I'm trying to get the count for each row to total count for each month
Something like this
Hardware | Jan
Monitors | 5
Processors | 137
Printers | 57
etc........
How can I write a query for this. I can get the Hardware column but don't know how to get the next column.If you can provide more data like sample input DML statements it would have been wonderful..
Assuming is , you need a pivot. Here is an article on basic Pivot..
http://sqlsaga.com/sql-server/how-to-use-pivot-to-transform-rows-into-columns-in-sql-server/
something like this may be..
DECLARE @Input TABLE
Hardware VARCHAR(20),
[Date] VARCHAR(20)
INSERT INTO @Input VALUES('Monitor', '01/01/2014'), ('CPU', '01/01/2014'), ('Monitor', '01/03/2014')
, ('ABC', '01/01/2014'),('Monitor', '02/01/2014')
;WITH CTE AS
SELECT Hardware, LEFT(DATENAME(M, [Date]),3) AS [MonthName] FROM @Input
SELECT *
FROM
SELECT Hardware, [MonthName], COUNT(Hardware) AS Count FROM CTE GROUP BY Hardware, [MonthName]) a
PIVOT (MAX([Count]) FOR [MonthName] IN ([Jan], [Feb])) pvt
Please mark as answer, if this has helped you solve the issue.
Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
Maybe you are looking for
-
Alright so two days ago my iphone worked just fine. Around lunch it would not turn on I had about 20 battery when I checked in the morning so I thought it was just dead. When I went home to plug it in for a little bit, it would not turn on any more.
-
Quite simply as described above. Upgraded to 7.0.2 this afternoon. All was fine until I restarted phone in a place where I know mobile coverage is weak. Since then I've been unable to connect to my mobile network, my sim card doesn't seem to be
-
New HD - No Airport Card?
I just installed a replacement hard drive, with fresh Mac OS. After start up, no airport. Any tips?
-
Hi i want to ceate customer through bapi with external no range not implici
hi i want to create customer through bapi which facilitates to enter customer code(our own defined not the sequentially next no.) i have gone through F.M BAPI_CUSTOMER_CREATEFROMDATA1 BUT NOT ABLE TO UNDERSTAND HOW TO INPUT PARAMETER FOR CUSTOMER_COD
-
XA jDriver for Oracle problem : Getting native code exception
Hi, I'm getting a native code exception which causes the Weblogic server to crash when using XA drivers for transaction with two oracle databases. My application uses RMI and threads. I'm using BEA's jDriver for Oracle running under Weblogic server 6