Advanced Datagrid - Summary Row without groupping
I need to make a datagrid with a summary row on top of it. It
works fine with the gropping tag inside of groupping collection.
But i don't need groups - i need only summaries.
When I white following code inside of Advanced - flex crashes
and tell something like "cannot null blablala".
quote:
<mx:GroupingCollection id="smallMetricsDataProvider"
source="{bigMetrics}">
<mx:summaries>
<mx:SummaryRow summaryPlacement="first">
<mx:SummaryField dataField="@type" operation="COUNT"
/>
<mx:SummaryField dataField="@budget"
summaryFunction="MetricsUtils.varianceTotalCount" />
<mx:SummaryField dataField="@raw"
summaryFunction="MetricsUtils.varianceTotalCount" />
</mx:SummaryRow>
</mx:summaries>
</mx:GroupingCollection>
What can you advice 4 me?
Thanks, Roman.
Fine, I found a way how to do it, using renderprovider 4
folder items with a null height =))).
It's a hack, the bad hack, i hope it wold be improved...
So, i have another problem - i want to get this summary
values. How?
Thanks, Roman.
Similar Messages
-
Rank only summary rows from group by rollup
I would like to rank only the total rows generated by a group by rollup, but not rank the rows within each group by bucket. Furthermore, I'd like to order by rank in descending order and include the unranked rows within each group.
My query looks something like this:
select customer, month, sum (sell)
from sales
group by rollup (customer, month)
order by customer, month desc nulls first
The results look like:
customer month sum(sell)
<summary rowA> 1,200
custA JAN 100
custA FEB 100
custA MAR 100
custA DEC 100
<summary rowB> 600
custB JAN 50
custB FEB 50
custB MAR 50
custB DEC 50
What I would like to do is:
select dense_rank() over (order by sum(sell) desc <rollup rows only>) as rank,
customer, month, sum (sell)
from sales
group by rollup (customer, month)
order by <summary row rank desc> customer, month desc nulls first
The results would look like:
rank customer month sum(sell)
1 <summary rowA> 1,200
custA JAN 100
custA FEB 100
custA MAR 100
custA DEC 100
2 <summary rowB> 600
custB JAN 50
custB FEB 50
custB MAR 50
custB DEC 50
Any advice?
Thank youLike this?
sql>
select decode(job,null,decode(deptno,null,null,dense_rank() over(order by lst desc)-1),null) rank,
deptno,job,sm
from(
select deptno,job,sm,last_value(sm) over(partition by deptno order by null ) lst
from (
select deptno,job,sum(sal) sm
from emp
group by rollup(deptno,job)));
RANK DEPTNO JOB SM
29025
20 CLERK 1900
20 MANAGER 2975
1 20 10875
20 ANALYST 6000
30 CLERK 950
30 MANAGER 2850
2 30 9400
30 SALESMAN 5600
10 CLERK 1300
10 MANAGER 2450
10 PRESIDENT 5000
3 10 8750 -
Efficiently retrieve MANY records with Advanced Datagrid?
Hi all,
I've encountered the following issue:
I have a database with more then 120.000 records, that I want to show with an advanced datagrid.
It's grouped by 2 ID's, thus showing the results a group within a group. This works perfect!
Only: it takes a long time before it shows the results, probably because it's downloading all the records at once (with the getAll() function).
Is there a way to use advanced datagrid more efficiently? Like: first download the two columns that are used to define the groups, and only retrieve data that's visible once you click the group? (In this case, the 2nd group within the 1st group)
This would greatly increase the loading-time of the whole application.
Or should I take an other aproach to this application, like, using a tree-component, a simple datagrid, writing alternative update & retrieve functions in AS3 & PHP?
Thanks!Hi Sam, thanks for your help!
I'm not sure though how to create the returned datastructure?
Example:
Product_id
productname
category_a
category_b
1
Toy A
boy
0-3
2
Toy B
girl
0-3
3
Toy C
girl
3-6
4
Toy D
boy
6-9
5
Toy E
girl
3-6
6
Toy F
boy
0-2
7
Toy G
boy
6-9
Grouping by [category_a] and [category_b], I would like to get the following in the Advanced Datagrid, but paginated:
Product_ID
Productname
boy
0-2
6
Toy F
0-3
1
Toy A
6-9
4
Toy D
7
Toy G
girl
0-3
2
Toy B
3-6
3
Toy C
5
Toy E
In my PHP-service, I would create the following query:
public function getProducts_paged($startIndex, $numItems) {
$stmt = mysqli_prepare($this->connection, "SELECT product_id, category_a, category_b, productname FROM $this->tablename GROUP BY category_a, category_b LIMIT(?,?)");
$this->throwExceptionOnError();
mysqli_bind_param($stmt, 'ii', $startIndex, $numItems);
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->product_id, $row->category_a, $row->category_a, $row->productname);
while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->product_id, $row->category_a, $row->category_a, $row->productname);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
This will give me the right structure, Right?
Now:
- How to tell the Advanced Datagrid which 2 groups to apply? -
Summary Row on adv. datagrid with no dataprovider
Hello,
Just new to Flex and still need to find out some things.
Created two advanced datagrids, the first WITH a dataprovider returning articles .. the second datagrid was added as a sort of Shopping cart and has no dataprovider.
I'm able to drag and drop articles from datagrid1 to datagrid2 (shopping cart), but I'm unable to show "Total price" at the bottom of the shopping cart.
Seems logical since it need data to make summary SUM field, but how can I tackle this best?
1. add empty dataprovider?
2. create an datacollection on the fly?
<mx:dataProvider>
<mx:GroupingCollection id="gc" source="CREATE DATACOLLECTION FROM ACTUAL PRESENT DATA">
<mx:Grouping>
<mx:GroupingField name="Territory">
<mx:summaries>
<mx:SummaryRow summaryPlacement="group">
<mx:fields>
<mx:SummaryField dataField="Price"
label="Total" operation="SUM"/>
</mx:fields>
</mx:SummaryRow>
</mx:summaries>
</mx:GroupingField>
</mx:Grouping>
</mx:GroupingCollection>
</mx:dataProvider>
Please advice.
thanks a million
TomBrlooks like it didn't understand correctly. Solution beneath is not adding a new row, but is only a solution for adding an extra column with some calculated value.
Am I correct that there is no default function for adding an extra row with the SUM of a column?
ok, added a datagrid since (as you mentioned) I'll need it anyway.
After adding a datagrid and creating a httpservice that can load data into the shopping cart, I'm still unable to add the SummaryRow with Totals
As soon as I remove the dataprovider="{getshopcartdataArray}" parameter from "<mx:AdvancedDatagrid" and add the extra <mx:dataProviderpart (with source pointing to correct DP) ... nothing works: loading data doens't work, drag/drop doens't work anymore and total row is not seen anyware
this is the datagrid and this is the page I used creating this: http://livedocs.adobe.com/flex/3/langref/mx/collections/SummaryRow.html
<mx:AdvancedDataGrid y="450" id="cart" initialize="gc.refresh();" designViewDataType="flat" height="250" left="10" dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" borderThickness="5" borderColor="#3F88BB" right="10">
<mx:dataProvider>
<mx:GroupingCollection id="gc" source="{getshopcartdataArray}">
<mx:Grouping>
<mx:GroupingField name="prijsexcl">
<mx:summaries>
<mx:SummaryRow summaryPlacement="group">
<mx:fields>
<mx:SummaryField dataField="prijsexcl"
label="Total" operation="SUM"/>
</mx:fields>
</mx:SummaryRow>
</mx:summaries>
</mx:GroupingField>
</mx:Grouping>
</mx:GroupingCollection>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn headerText="ID" dataField="cdartikel" width="30" editable="false"/>
<mx:AdvancedDataGridColumn headerText="Zoeknaam" dataField="zoeknaam" width="40" editable="false" />
<mx:AdvancedDataGridColumn headerText="Omschrijving" dataField="omschr" width="150" editable="false" />
<mx:AdvancedDataGridColumn headerText="Prijs Incl" dataField="prijsincl" width="30" editable="false" />
<mx:AdvancedDataGridColumn headerText="Prijs Excl" dataField="prijsexcl" width="30" editable="false" />
<mx:AdvancedDataGridColumn headerText="Prijs per" dataField="prijsper" width="30" editable="false" />
<mx:AdvancedDataGridColumn headerText="Eenheid" dataField="eenheid" width="30" editable="false" />
<mx:AdvancedDataGridColumn headerText="Datum verschijning" dataField="verschijningsdatum" width="40" editable="false" />
<mx:AdvancedDataGridColumn datafield="Total" />
</mx:columns>
</mx:AdvancedDataGrid> -
Filtering of Grouped data in Advanced DataGrid
I want to display the Hierarchical Data (groped data) in
Advance DataGrid and at the same time I want the filtering
functionality as well. The problem is if I want grouped view then I
have to provide GroupingCollection to the dataprovider ( that has
no filterFunction type functionality ).
Is there any way to solve this issue?You have to call adg.validateNow() after assigning the
GroupingCollection as dataProvider to the AdvancedDataGrid and
before applying the filterFunction.
It should be like -
adg.dataProvider = gc;
adg.validateNow();
IHierarchicalCollectionView(adg.dataProvider).filterFunction
= filterFunc;
IHierarchicalCollectionView(adg.dataProvider).refresh();
Note: The filter function will be applied to group rows
also. -
Grouping of Data in Advanced Datagrid
Hii,
I need to group the data in advanced datagrid. I used the Grouping collection class, but it it not working.
My advanced datagrid has column groups...so will this have any impact on grouping.
Thanks!!
VikasAssuming that the table (say WALK_IN_PER_LOG) that you have has atleast the following two columns
walk_in_date DATE -- holds date time stamp
dob DATE -- holds date of birth
SELECT TO_CHAR(walk_in_date,'WW')| |'-'| |TO_CHAR(walk_in_date,'DAY') "Week#-Day"
,TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02),'09')| |'-'| |
TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02)+2,'09')
,COUNT(*)
FROM walk_in_per_log
WHERE MONTHS_BETWEEN(SYSDATE,dob) > 18*12
GROUP BY TO_CHAR(walk_in_date,'WW')| |'-'| |TO_CHAR(walk_in_date,'DAY')
,TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02),'09')| |'-'| |
TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02)+2,'09')
PS I might have complicated the query a little in trying to get the formatting as you had requested but the principle is simple
First group by the day, so that all events of one day can be compared together, then extract the hour portion of each of those dates and divide by 2 and use the quotient of the division as a grouping factor.
eg
from hours
00-02 the quotient is 0 (2 is taken as 1:59:59)
02-04 the quotient is 1 (4 is taken as 3:59:59)
and so on
hope this helps.... -
Grouping issue on Advanced DataGrid
Hello,
I've got an advanced datagrid with 5 columns, The number_Group column has data like this...
1-10
1-10
11-20
11-20
11-20
21-30
21-30
21-30
41-50
101-110
When I apply Grouping, it works as expected but the 101-110 group is displayed before the 11-20 group.
I've tried to set groupingField.numeric = true but that screws it up even more... because 11-20 isn't a number I'm guessing.
Does anyone know a way around this? I could change the number_Group column to this...
1
1
11
11
21
41
101
and groupingField.numeric = true should work but I need the Grouping display to show 1-10, 11-20. Perhaps I can intercept this and modify it?
Anyone got any ideas?
Thanks,
NickHi, Nicky
u can solve this problem by grouping function.
u create ur dataprovider like
private var myData:ArrayCollection = new ArrayCollection([{data1:1, data2:10,......},
{data1:1, data2:21, ....}]);
u declare the grouping function in following manner
private function myGroupLabelFunction(item:Object, column:AdvancedDataGridColumn):String
// here u write ur logice to formatting ur dispalying data in advance grid.
//suppose ur labelfield of datagrid are data1,data2, data3 respectively.
return item.data1+"-"+item.data2;
if u do in this way i think it will work.
if u sucess then give me mark.
Thanks
Niranjan -
Removal of grouping icon on advanced datagrid
Hi
Is it possible to remove the folder icon when you having grouping on the advanced datagrid? I ve done some googling but cant find a solution.
Cheers
ShaunHi, Nicky
u can solve this problem by grouping function.
u create ur dataprovider like
private var myData:ArrayCollection = new ArrayCollection([{data1:1, data2:10,......},
{data1:1, data2:21, ....}]);
u declare the grouping function in following manner
private function myGroupLabelFunction(item:Object, column:AdvancedDataGridColumn):String
// here u write ur logice to formatting ur dispalying data in advance grid.
//suppose ur labelfield of datagrid are data1,data2, data3 respectively.
return item.data1+"-"+item.data2;
if u do in this way i think it will work.
if u sucess then give me mark.
Thanks
Niranjan -
Hiding item renders in Group Datagrid Label Rows?
I have an Advanced data grid displaying a grouped collection. I have an item renderer in one column the is a canvas with a button that is bound to the data.
However, buttons are also showing on the header rows, where they are not needed (see below). How do I fix this?I have an Advanced data grid displaying a grouped collection. I have an item renderer in one column the is a canvas with a button that is bound to the data.
However, buttons are also showing on the header rows, where they are not needed (see below). How do I fix this? -
HP QTP10 cannot read Automation values of Advanced DataGrid
Hi everyone,
We're an Automation functional testing team, testing a flex application with HP QTP v10. So far we've successfully automated many parts of the application. Now, we're struck at a serious issue.
The issue is QTP cannot read automation values specified for an Advanced Datagrid (ADG).
While trying to read row data of the ADG, the automation name of QTP shows like,
"lblData | someGroup | | ** | | | | | | | | | | lblData"
The screenshot of Object Spy while spying ADG is also attached.
Other than the Automation Index, we are not able to populate any automation values of a row data.
The ADG is a custom one. Our development team has customized it in some way, and we dont have access to the code. They are using an External renderer or Custom renderer to render values into the column.
As there is no possiblity for value-based recording, we tried to access the ADG with index-based recording. Then, we 're able to perform operations like Click, but cannot read contents of the row/cell.
We're using:
HP Quick TestProfessional v10.0
Flex plugin 4.5
Internet Explorer 7
Flash Player v10
Our Questions are:
How to get automation values for these custom ADG?
Is there any other possible ways to access the custom ADG components other than these automation values?
Do we need any patches/plugin upgradation to perform this?
Is there any other tools in market that can recognize and access these custom ADGs?
Without these automation values we're unable to proceed further work. Any replies/comments/help are welcome.
Thank you!A sortCompareFunction would look something like:
Function sortWithNullAtEnd(a:Object, b:Object, field:Array = null):int
if (a.fieldName == null && b.fieldName == null) return 0;
if (a.fieldName == null) return 1;
if (b.fieldName == null) return –1;
if (a.fieldName < b.fieldName)
return –1;
if (a.fieldName > b.fieldName)
return 1;
return 0;
Note that this sort would be unstable so you might be better off using a second field to get stability. -
SortcompareFunction is not working properly for more than 1 column in advanced datagrid
Hi Guys,
I am using an advanced datagrid with groupingCollection.
I have more than 1 grouped column. How ever I am using 2 sort compare function to sort date and time.
The problem is when I am trying to sort date its workinf properly then when I jump to time column its not working and sorting few rows only inside the column but not the entire column. samething happen when I sort time first and the date is not sorting.
any help will be really appriciable .
Thanks in advance.In our application we tend to use views to return appropriate values for a particular user.
For example (we do building inspections) the publication item sql is like
select * from inspection_sites where id in (select site_id from v_pda_bi_sites where bi_id=:bi_id)
The view acts like a dynamic parameter table (in this cases looks at experience level, status of sites, and responsibility allocations). Once the driving views are tuned this works quite efficiently, and as the dependant tables for the publication item automatically includes all of the tables in the driving view, the object gets refreshed if there is any change to any of them, even if the site details themselves have not changed -
Lock datagrid last row with agregates (don't know what to do next :( )
Hi,
I have been googling for 2 hours and have been reading some forum posts, etc... but can't get this thing working. It seems an important flaw in datagrid, because I'm sure lota peopple needs this, but I've not found a good solution.
What I need to do is add a row of agregates to a datagrid that contains flat data (it must be last one, and locked, I mean, must not scroll). I have been reading about this:
http://blogs.adobe.com/aharui/2008/03/flex_3_datagrid_footers.html
But this makes the row separated from the grid, I mean, It is not really a datagrid row. Other problems arise using this implementation like, impossibility to keep last row aligned with datagrid columns when scrolling (I need to scroll because I have lota columns), etc...
So, could anybody please help here to accomplish this? I think it is a pretty common task and it is a bit dissapointing it can't be done easily with flex.
Thanks in advance,
Aron.I haven't seen this done.
You can add a summary row fairly easily using the Advanced Data Grid:
http://livedocs.adobe.com/flex/3/html/help.html?content=advdatagrid_10.html -
I am new to Flex. I wasn't quite sure how to code summary
rows in actionscript. Could some take a look at my codes and help
me figure out why it doesn't work? I really appreciate it.
I need to display a fixed data in group row. That is, I don't
need to calculate the result to be displayed in group row."irislpc" <[email protected]> wrote in
message
news:ghpdmn$s2k$[email protected]..
> If I am not displaying the hierarchical data in
AdvancedDataGrid by using
> group
> collection, can I still use summary rows? I populate the
advanced data
> grid
> with external xml file. The xml is structured
hierarchically so that I
> don't
> need to group the data. The problem is I have data that
need to be
> displayed in
> group row. Can I use summaries function to do that?
> Here is the sample application
>
http://www.irislin.net/itemRenderer/reliability.html
http://livedocs.adobe.com/flex/3/html/help.html?content=advdatagrid_08.html
"Note: Summary data is not supported for hierarchical data
represented by
the HierarchicalData class. You can only create summary data
for data
represented by the GroupingCollection class."
I couldn't get at your app, since I'm not going to upgrade to
Flash Player
10 just to help you (I think that change is far more
difficult to undo than
to do), but you might find that you can make a
GroupingCollection from your
XML just by casting it. -
How can i create a grid with summary row
Hello Professionals,
I'm wondering how could i create a grid like the grid below, i want to create a grid with summary row,
i have tried to create it using collapsing but it didn't work as required.
Any suggestions?, i want to know just the starting point so i can make deep investigations.
Thanks in Advance,Hi Karem,
this can be achieved by just assigning a datatable containing the data plus some formatting of grid. Meaning there is no feature for that.
The datatable can be filled manually or by sql query. Then you have to attach some events for updating the values ( validate after for gid item ).
A small example for a sql query showing last month quotations and orders with summary :
select 1 as Sort,cast(DocNum as varchar) as DocNum,DocTotal,convert(varchar, DocDate,104) from OQUT where DocDate between DATEADD(month, -1, GETDATE()) AND GETDATE()
UNION ALL
Select 2 as Sort,'Summary ( Quotation ) : ',sum(DocTotal), convert(varchar, DATEADD(month, -1, GETDATE()),104)+' - '+convert(varchar, GETDATE(),104) from OQUT where DocDate between DATEADD(month, -1, GETDATE()) AND GETDATE()
UNION ALL
select 3 as Sort,cast(DocNum as varchar) as DocNum,DocTotal,convert(varchar, DocDate,104) from ORDR where DocDate between DATEADD(month, -1, GETDATE()) AND GETDATE()
UNION ALL
Select 4 as Sort,'Summary ( Order ) : ',sum(DocTotal), convert(varchar, DATEADD(month, -1, GETDATE()),104)+' - '+convert(varchar, GETDATE(),104) from ORDR where DocDate between DATEADD(month, -1, GETDATE()) AND GETDATE()
ORDER by Sort
regards,
Maik -
Drag and Drop in DataGrid/Advanced DataGrid
Hi All,
Here is the scenario, assume that i have some 10 records in
DataGrid/Advanced DataGrid .I have selected 4th record and when i
try to drag the selected item to
down, i should be able to drag all the records one step down
from the selected record( from 4 th record to 10th record)
i.e, re-arranging the items
If i drag the selected item(assume that some 6th record) to
top, say to 2nd row then from the second row all the rows
has to come down.
And How do we
add the rows at middle and at the specified position?
Any help will be appricated and Thanks in Advance.Hi All,
myself got the solution for re-arranging the datagrid items
by using the pre-defined properties of DataGrid.
I can also get the index number of Items while start dragging
but the problem is how do i get the index number where the Items
dropped.
Here is the code..............
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="horizontal">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
[Bindable]
private var datagridData:ArrayCollection = new
ArrayCollection([
{task:"testing drag and
drop",category:"Office",priority:"Medium"},
{task:"testing datagrid
DND",category:"personal",priority:"High"},
{task:"testing services for
todo",category:"office",priority:"Medium"},
{task:"meet ravi on
sunday",category:"personal",priority:"Low"},
{task:"buy a book",category:"friends",priority:"Medium"},
{task:"play cricket",category:"friends",priority:"Low"}]);
private function onDragStart():void
Alert.show("selected Indices"+dataGrid.selectedIndices);
private function onDragComplete():void
Alert.show("selected Indices"+dataGrid.selectedIndices);
]]>
</mx:Script>
<mx:DataGrid id="dataGrid" dataProvider="{datagridData}"
dragEnabled="true" dragMoveEnabled="true"
dropEnabled="true" allowDragSelection="true"
allowMultipleSelection="true" rowCount="10"
dragStart="onDragStart()"
dragComplete="onDragComplete()">
<!--dragStart="onDragStart()"-->
<mx:columns>
<mx:DataGridColumn dataField="task" headerText="Task"
width="200"/>
<mx:DataGridColumn dataField="category"
headerText="Category"/>
<mx:DataGridColumn dataField="priority"
headerText="Priority"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
Maybe you are looking for
-
Error ID in SMXB_MONI in XI 3.0
Hallo, during the execution of my graphical mapping, in a user defined function, when I find an error (for example about a query or a translation) I need to throw an exception. How I can break the execution of the mapping and I send a good log to my
-
PDF text is unreadable on screen and in print-out
One of my co-workers brought to me several PDF saves of the homepage of the Chicago Tribune and an article from the Wall Street Journal. The format of the document looks normal, but a portion of the text form the Tribune page and nearly the entire pa
-
Insert Multiple Records into Multiple ZTABLEs inside the BAPI
Hi, I have a requirement to Insert or Update Multiple Records into a ZTABLE inside the BAPI. Is there any special approach inside the BAPI to insert or update ZTABLEs with multiple records. It looks like the simple INSERT Statement is not working. Ca
-
I'm wanting to use a firewire cable to get some video off my dv camera, but im not sure what cable need. will my google search of "dv to firewire 800" fetch the correct cables? or are there different types of firewire 800? the dv end of the cabels in
-
hello all! please, help me again. we have a foreign key discrepancy and my task is to create a view which will show the 3 aspects. Let's we have 3 schemas: A - good (which means that i will compare WITH A, source) B and C are bad (which mean that I w