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!!
Vikas

Assuming 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....

Similar Messages

  • 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 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,
    Nick

    Hi, 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

  • Advanced Datagrid GroupingCollection of flat data (XMLLISTCollection) while sorting throws exception

    HI,
         Iam using AdvancedDatagrid inorder to group the flat data populated from the backend through BlazeDS. Result data will be in xml format and i have converted it to xmllistcollection and assigned to the grouping collection source. Flat data is grouped by one of the attribute called 'Name' and refreshed after data has been populated.
    Data structre used as input is: WIth this structure, iam grouping by the field 'Name'.
      <Report> <att_report>
      <id>FDR1</id>
      <Name>Feeder 1</Name>
      <frequency>Monthly</frequency>
      <Field>Finance 1</Field>
      <Aug_10>100</Aug_10>
      <Jul_10>200</Jul_10>
    </att_report>
    <att_report>
      <id>FDR1</id>
      <Name>Feeder 1</Name>
      <frequency>Yearly</frequency>
      <Field>Finance 2</Field>
      <Jul_10>200</Jul_10>
    </att_report>
    <att_report>
      <id>FDR2</id>
      <Name>Feeder 2</Name>
      <frequency>Quarterly</frequency>
      <Field>Finance 3</Field>
      <Jul_10>2000</Jul_10>
    </att_report>
    <att_report>
      <id>FDR2</id>
      <Name>Feeder 2</Name>
      <frequency>MOnthly</frequency>
      <Field>Finance 2</Field>
      <Jul_10>2000</Jul_10>
    </att_report>
    <att_report>
      <id>FDR4</id>
      <Name>Feeder 4</Name>
      <frequency>yearly</frequency>
      <Field>Finance 5</Field>
      <Jul_10>2000</Jul_10>
    </att_report>
    </Report>
    Grouping is done as expected. We have additional functionalities like soring / seraching of the result set. Either one is working fine. Other functionality throws excpetion mentioned below.
    When any of the advanced datagrid grid column header is clicked for sorting, it throws exception. I have pasted the exception below for reference.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.collections::HierarchicalCollectionView/internalRefresh()[C:\work\flex\dmv_automation\ projects\datavisualisation\src\mx\collections\HierarchicalCollectionView.as:709]
    at mx.collections::HierarchicalCollectionView/refresh()[C:\work\flex\dmv_automation\projects \datavisualisation\src\mx\collections\HierarchicalCollectionView.as:686]
    at mx.controls::AdvancedDataGridBaseEx/sortHandler()[C:\work\flex\dmv_automation\projects\da tavisualisation\src\mx\controls\AdvancedDataGridBaseEx.as:6869]
    at mx.controls::AdvancedDataGrid/sortHandler()[C:\work\flex\dmv_automation\projects\datavisu alisation\src\mx\controls\AdvancedDataGrid.as:6899]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.controls::AdvancedDataGrid/headerReleaseHandler()[C:\work\flex\dmv_automation\projects \datavisualisation\src\mx\controls\AdvancedDataGrid.as:7120]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.controls::AdvancedDataGridBaseEx/mouseUpHandler()[C:\work\flex\dmv_automation\projects \datavisualisation\src\mx\controls\AdvancedDataGridBaseEx.as:5738]
    at mx.controls::AdvancedDataGrid/mouseUpHandler()[C:\work\flex\dmv_automation\projects\datav isualisation\src\mx\controls\AdvancedDataGrid.as:8457]
    I tried with couple of options but still not able to get rid of the excpetion. I browsed through couple of links also, still not able to find an solution. Can i know whether it is a bug or it can be fixed.
    Any help / suggestions on this will be great.
    Thanks in Advance,
    Srinivasan

    Read the error messages and pay attention to the line number of the error:
    1)1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile()
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args)
    11   {
    12     openFile();
    13   }
    14 }
    $ javac -cp "" Test.java
    Test.java:7: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
        FileOutputStream f = new FileOutputStream("data.txt");
                             ^
    1 error2)1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile() throws FileNotFoundException
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args)
    11   {
    12     openFile();
    13   }
    14 }
    $ javac -cp "" Test.java
    Test.java:12: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
        openFile();
                ^
    1 error3)
    1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile() throws FileNotFoundException
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args)
    11   {
    12     try
    13     {
    14       openFile();
    15     }
    16     catch(FileNotFoundException e)
    17     {
    18       System.out.println("Error file doesn't exist.");
    19     }
    20   }
    21 }
    $ javac -cp "" Test.java
    $
    1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile() throws FileNotFoundException
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args) throws FileNotFoundException
    11   {
    12     openFile();
    13   }
    14 }
    $ javac -cp "" Test.java
    $

  • Multiple data sources for a (advanced)datagrid?

    Hi all,
    I have two arrays of objects coming in from two different sources keyed on a single column called "id". They have the exact same column structure. I want to show these in a grouped column structure in advanced data grid. The question is can I do that without manually merging the two arrays?
    Concrete example:
    Array1: [{id:1, name:"Cooper", zip:"94536"},
                 {id:2, name:"Corolla", zip:"94404"}]
    Array2: [{id:1, name:"One", zip:"94555"},
                 {id:2, name:"Camry", zip:"94403"}]
    This will look like:
    Id
    Name
    Zip
    Source1
    Source2
    Source1
    Source2
    1
    Cooper
    One
    94536
    94555
    2
    Corolla
    Camry
    94404
    94403
    I would like to do this without creating an array like:
    [{id:1, name1:"Cooper", name2:"One", zip1:"94536", zip2:"94555"},
    {id:1, name1:"Corolla", name2:"Camry", zip1:"94404", zip2:"94403"}]
    Charts are quite good at this since you can assign different data sources to different series and the axis defines the key on which the data will be merged. However, I could not find anything similar for tables.
    Any pointers?
    Thanks so much!

    Come to think of it, is this even possible? How does a datagrid use its dataField parameter to lookup data? I am guessing data_array[row_index][col.dataField] would determine the value of a single cell at row_index and col. If so, my naive approach would require me to override the bracket operator so that the appropriate value is returned..
    e.g. when a simple array of objects is used, you have [{name:John, lastname:Smith}], datagridcolumns dataField is then set to "name". Now I will have two separate arrays:
    arr1: [{name:John, lastname:Smith}]
    arr2: [{name:Smith, lastname:John}]
    mergedarray will have a reference to both of them. Then when getKey("name", 1) is called, it will return a special key which can be used to access the name property from array 1, something like "name1". If I cannot override the bracket operator, mergedarray[0][name1] will return nothing.
    I remember reading somewhere that this kind of override is not possible. Any ideas?

  • 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
    Shaun

    Hi, 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

  • Its near impossible to get a Advanced datagrid to remember its opened nodes when it has fresh data

    Theres a post in
    http://www.mail-archive.com/[email protected]/msg85521.html//www.mail-archive.com/[email protected]/msg85521.html
    which is basically saying its near impossible to get a Advanced datagrid to remember its opened nodes when it has fresh data
    I'm having pretty much the same problem (exept I'm not filtering just getting the latest data from the server)as this guy and have been searching for a solution, heres what he said:
    Sun, 02 Mar 2008 08:07:46 -0800
    Hello guys,
    I'm trying to filter my ADG without success :
    I created a GroupingCollection from a flat ArrayCollection.
    ADG's dataProvider is GroupingCollection.
    First issue : refresh
    if I filter the underlaying ArrayCollection, the related
    groupingCollection doesn't refresh automatically (bug? feature?)
    Actually I menaged to force gc.refresh() with some event( it is
    impossible to listen on CollectionEventKind.REFRESH because of
    infinite loop ac.refresh => gc.refresh )
    Second issue (more important) : openNodes
    Ok now that my gc is refreshed, the Tree in the ADG collapses itself
    (ok let say that is normal), and I need it to expand all nodes that
    were opened before.
    I tried to do something like this :
    var openNodes : Object = IHierarchicalCollectionView(
    myADG.dataProvider ).openNodes;
    gc.refresh();
    myADG.dataProvider.openNodes = openNodes;
    and it doesn't works.
    next I tried this :
    var openNodes : Object = IHierarchicalCollectionView(
    myADG.dataProvider ).openNodes;
    for each( var node : Object in openNodes )
    IHierarchicalCollectionView( myADG.dataProvider.openNode( node )
    guess what, doesn't work
    I'm calling myADG.invalidateList() each time too.
    I don't know what to do to achieve this simple task, I'm a bit
    disappointed because I expected lot more from the brand new
    AdvancedDataGrid and this basic functionality actually seems too hard
    to implement.
    I still hope I'm wrong and someone can show me the correct solution
    Thank you all,
    Adnan

    Hi,
    I remember the days when Oracle would practically give Oracle Financial s away just for the implementation consulting fees.
    Yeah, IBM used to give-away DB2 also . . . .
    Oracle Financial s away just for the implementation consulting fees. Yeah, but any ERP requires massive set-up costs. I once worked on an SAP effort that cost over $20,000,000.
    complete with Microsoft head to headIn what? Oracle is far-and-away the world's most robust and flexible database, hundreds of times more powerful that SQL Server.
    IMHO, it's like apples-to-oranges . . . .
    Everyone is running SQL server Here, DICE shows over a hundred Oracle openings in the Boston area, that might help you:
    http://seeker.dice.com/jobsearch/servlet/JobSearch?op=300&rel_code=1102&N=0&Hf=0&NUM_PER_PAGE=30&Ntk=JobSearchRanking&Ntx=mode+matchall&AREA_CODES=&AC_COUNTRY=1525&QUICK=1&ZIPCODE=&RADIUS=64.37376&ZC_COUNTRY=0&COUNTRY=1525&STAT_PROV=0&METRO_AREA=33.78715899%2C-84.39164034&TRAVEL=0&TAXTERM=0&SORTSPEC=0&FRMT=0&DAYSBACK=30&LOCATION_OPTION=2&FREE_TEXT=oracle&WHERE=Boston+MA&WHEREList=Boston+MA&SEARCH.x=0&SEARCH.y=0
    Excel is the tool of choice for accountants and its integration withcubes is nothing short of stunning
    Sorry, I must disagree! Yes, CPA's will download Oracle data into spreadsheets for analysis, but Excel is wanting, especially for hypothesis testing, correlational analysis and data mining. Oracle's ODM, however, is truly stunning, light-years ahead of PC-based tools:
    http://www.rampant-books.com/book_2006_1_oracle_data_mining.htm
    Larry make Oracle great again be cutting the costI cannot speak for Oracle Corporation, but Oracle XE is FREE, totally and completely free. Add-in Apex for free, and it's very competitive.
    Hope this helps. . .
    Don Burleson
    Oracle Press author
    Author of “Oracle Tuning: The Definitive Reference”
    http://www.dba-oracle.com/bp/s_oracle_tuning_book.htm

  • Does compiling an advanced datagrid using flex ant task require additional config other than the license property?

    Hi,
        I am trying to build my Flex app which uses the Advanced Data Grid in a couple of locations. Originally, when I built the app using the flex ant tasks, I noticed the Visualization Trial watermark show up on the screen. I then added the license tag with the serial number to my flex-config.xml and re-ran my ant build. The watermark goes away, but then when I look at the advanced datagrid, the datagrid shows up with the hierarchy, but the data does not display in the grid (only the group by nodes are visible, not the data for the leaf elements). This works fine when I build the app using my Flex Builder. Is there something I am missing or need to add to my flex ant task to make this work?
    Any help or guidance is much appreciated.
    The following is the ant task to build the module that uses the ADG:
        <target name="compile-modules" depends="compile-shared">
            <!-- Module 1 -->
            <echo>Compiling module 1...</echo>
            <mxmlc file="${modulesrc.dir}\ui\modules\mod1\Module1.mxml"
                    output="${dist.dir}\modules\mod1\Module1.swf"
                    actionscript-file-encoding="UTF-8"
                    incremental="true"
                    default-background-color="0xFFFFFF"
                    use-network="false"
                    load-externs="${extern-report-xml}">
                <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
                <source-path path-element="${FLEX_HOME}/frameworks"/>
                <!-- source paths -->
                <compiler.source-path path-element="${modulesrc.dir}"/>
                <!-- add external libraries -->
                <compiler.library-path dir="${main.dir}" append="true">
                    <include name="${lib.dir}"/>
                </compiler.library-path>
                <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
                    <include name="libs" />
                    <include name="locale/{locale}" />
                </compiler.library-path>
                <compiler.debug>true</compiler.debug>
            </mxmlc>
        </target>
    And here is the ant task for the main application:
        <target name="compile-ui" depends="compile-modules">
            <mxmlc file="${src.dir}/MainApp.mxml" output="${dist.dir}/MainApp.swf"
                    actionscript-file-encoding="UTF-8" keep-generated-actionscript="false"
                    fork="true" maxmemory="1024m">
                <jvmarg value="-XX:MaxPermSize=256m"/>
                <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
                <source-path path-element="${FLEX_HOME}/frameworks"/>
                <source-path path-element="${src.dir}"/>
                <source-path path-element="${main.dir}/locale/{locale}"/>
                <!-- List of SWC files or directories that contain SWC files. -->
                <!--<compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
                    <include name="libs" />
                    <include name="locale/{locale}" />
                </compiler.library-path>-->
                <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
                    <include name="libs/datavisualization.swc" />
                    <include name="libs/flex.swc" />
                    <include name="libs/framework.swc" />
                    <include name="libs/rpc.swc" />
                    <include name="libs/utilities.swc" />
                    <include name="locale/{locale}" />
                </compiler.library-path>
                <compiler.library-path dir="${main.dir}" append="true">
                    <include name="${lib.dir}"/>
                </compiler.library-path>
                <runtime-shared-library-path path-element="${FLEX_FRAMEWORK}/framework.swc">
                    <url rsl-url="framework_3.2.0.3958.swf"/>
                    <url rsl-url="framework_3.2.0.3958.swz"/>
                </runtime-shared-library-path>
                <compiler.debug>true</compiler.debug>
            </mxmlc>
        </target>
    Regards,
    Purush

    to remove watermark i have added license key in WEB-INF\flex\license.properties file as key = value

  • 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

  • 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?

  • TSQL query to calculate Count / Sum grouping by date on a Pivot Table

    Hi All
    I need help to group the pivot table output to group by dates and sum/count the values. I have a table like shown below.
    Date
    Student 
    Subject
    Hunt
    Marks
    18/02/2014
    Sam 
    Maths
    1
    20
    18/02/2014
    Sam 
    Maths
    1
    10
    18/02/2014
    Sam 
    Maths
    2
    30
    18/02/2014
    Luke
    Science
    1
    50
    17/02/2014
    Sam 
    Maths
    2
    50
    17/02/2014
    Luke
    Science
    2
    60
    16/02/2014
    Luke
    Science
    2
    20
    16/02/2014
    Luke
    Science
    3
    20
    I want to Group by dates and move the Hunt to columns calculating their counts and sum their marks too. Like given below.
    I wrote a pivot query like below but If i group it with dates and calculate the total marks it throws aggregate errors.
    Create Table Student_Log ([Date] datetime ,Student varchar (20), Subject varchar (20) ,Hunt int ,Marks int )
    Go
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','10')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','2','30')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Luke','Science','1','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Sam ','Maths','2','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Luke','Science','2','60')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','2','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','3','20')
    Go
    select * from Student_Log
    select [DATE] , [Student], [Subject] ,[1],[2],[3],[4],Total =([1]+[2]+[3]+[4])
    from
    ( select [Date], [Student], [Subject],[Hunt],[Marks] from Student_Log
    )x
    pivot
    count ( [Hunt]) for [Hunt]
    in ([1],[2],[3],[4])
    )p
    order by [Date] desc
    I have done this far only. More than this I need to enhance it with the Percentage of Hunts for each Student.
    ie like below table.
    On 18th Sam in Maths he had 2 rows on 1st hunt  and 1 row on 2nd hunt. So On the Pivot table is it possible to represent it on percentage using the Total Attempts column.
    Thanks a lot in advance.
    Its runnung in SQL 2000 Server.

    Create Table Student_Log ([Date] datetime ,Student varchar (20), Subject varchar (20) ,Hunt int ,Marks int )
    Go
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','10')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','2','30')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Luke','Science','1','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Sam ','Maths','2','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Luke','Science','2','60')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','2','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','3','20')
    Go
    select * from Student_Log
    ;with mycte as
    Select [Date], [Student], [Subject] ,
    Count(CASE WHEN [Hunt]=1 Then Hunt End) as Hunt1,
    Count(CASE WHEN [Hunt]=2 Then Hunt End) as Hunt2,
    Count(CASE WHEN [Hunt]=3 Then Hunt End) as Hunt3,
    Count(CASE WHEN [Hunt]=4 Then Hunt End) as Hunt4,
    Count(CASE WHEN [Hunt]=1 Then Hunt End)
    +Count(CASE WHEN [Hunt]=2 Then Hunt End)
    +Count(CASE WHEN [Hunt]=3 Then Hunt End)+
    +Count(CASE WHEN [Hunt]=4 Then Hunt End) as Total,
    ISNULL(SUM(CASE WHEN [Hunt]=1 Then Marks End),0) as Mark1,
    ISNULL(SUM(CASE WHEN [Hunt]=2 Then Marks End),0) as Mark2,
    ISNULL(SUM(CASE WHEN [Hunt]=3 Then Marks End),0) as Mark3,
    ISNULL(SUM(CASE WHEN [Hunt]=4 Then Marks End),0) as Mark4
    from Student_Log
    Group By [Date], [Student], [Subject]
    Select [Date], [Student], [Subject]
    , Cast(Hunt1*1./Total*100 as int) as [1]
    , Cast(Hunt2*1./Total*100 as int) as [2]
    ,Cast(Hunt3*1./Total*100 as int) as [3]
    ,Cast(Hunt4*1./Total*100 as int) as [4]
    ,Total,Marks=( Mark1+Mark2+Mark3+Mark4)
    from mycte
    order by [Date] DESC, Student desc
    drop table Student_Log

  • How to show 2 groups of data in 1 XY plot at different time?

    Hi, all:
    I have a question and hope someone can help me figure out the solution or whether or not no solution for the question. I need to collect 2 groups of data [x(n),y(n)] and [x(n),z(n)]. I will collect x-y first then x-z. I need to collect and show the x-y data first, when I am satisfied, then collect and show the x-z data. It should be in the same plot. I got an error message so far and cold not figure out the solution. I attached my code and hope someone can help me. The code is in version 8.0 and I am sure there is no virus. Thank you a lot in advance.
    Attachments:
    plots.vi ‏13 KB

    Hello ccyang
    When you look the context help of the xy-graph in the diagram, you see the supported data types. An array of xy-clusters is accepted. You may look in the attached code how you could built the array  of the two plots.
    Check the example VIs included in LabVIEW (in the help menu). There are several examples on charts and graphs.
    Greetings
    shb
    Attachments:
    plots executable.vi ‏15 KB

  • PLEASE HELP!! Need some way to read header text in advanced datagrid using QTP

    I am writing a function to read column names in advanced data
    grid. There is no operation for that and any of the properties that
    I can use to read the column names.
    Please suggest any way that I can get the names of columns in
    the advanced data grid.
    Thanks

    I hope to hear something from adobe folks...I am providing
    more info.....
    I am using QTP 9.2 and Flex 3 add-in available from Adobe.
    My application has flex Advanced datagrid object and I am
    trying to read column names for the datagrid.
    I have contacted developers and they told me that column
    names for flex advanced datagrid are stored in "Header Text"
    I have tried reading "Header Text" using
    GetROProperty("HeaderText") but it doesn't return anything.
    I have tried the following code:
    x =
    Browser("app").FlexApplication("flexapp").FlexCanvas("Canvas").FlexAdvancedDatagrid("esti mategridid").GetROProperty("Header
    Text")
    msgbox x
    I have also tried getting value for column names using other
    available properties for webtables like outerhtml, outertext, alt
    etc. but I don't get any data.
    Part of the problem may be because none of the above
    mentioned properties are supported by Flex Advanced datagrid.
    I have also tried getting child objects but I always get the
    data in datagrid as values but not the column names.
    My primary reason for getting column names is to write a
    function to update cell in datagrid independent of application. So,
    I want to pass column name as a parameter to the function and get
    the corresponding columnIndex in the function by comparing the
    parameter value against column names.
    Thanks to all for you help...

  • Add business partner to target group - some data missing

    Hello,
    I created a target group. This target group includes data of person and the associated data of organization (for example: city, street, ...). Now I want add some other person. I have two opportunities when I have open the target group:
    1. In the table of the target group
    In the column "Business Partner ID" I can open the input help and search the person which I want add zu the target group
    2. In the view of the target group
    On the top there is a button "Import Business Parterns", there I can upload txt files with the bp-no. from the person.
    It works only the first possibility. There are all data of person and organization included.
    At the second possibility there are the data of person included, but it lacks the data of organization and I don't know why.
    Does anybody know, what's the problem? Is it standard or is it a bug?
    Thank you in advance.
    Best regards, Jasmin

    For information:
    When you want add business partner by file upload to the target group, in the SAP standard the target group can handle only one ID, either the account ID or th contact ID. So when I add some contact IDs by file upload to the target group then I miss the data of the account. So, I have to build up the same target group a second time.

  • 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.

Maybe you are looking for

  • Safari crashes before launching

    Hello, Today is the first time that I have run into this problem. As soon as I click into safari the home page goes to load, the beach ball of death appears and safari crashes. It does this every time, please help! My latest report is as follows: Pro

  • ALE Step By Step

    Hi Friends, Plz any one can give the brief step by step ALE , EDI, IDOC I don't need the screen shots just sequence of transactions . Please do this favor for me from long time am struggling with this. thanks in Advance, Sheethal.

  • JNI / Garbage Collection question

    I have a C++ library I am calling into from our application. The question I have is I want the library to return a jintarray or a jstringarray (not sure which yet). If they create that array in the function and then return it to me as the return type

  • Is there a way to block unwanted e-mails and spam on your mobile devices?

    Is there a way to block unwanted e-mails and spam on your mobile devices?

  • Gnome: changing application icon size

    Before gnome 3.10,according to wiki, to change app icon size it was necessary to edit "/usr/share/gnome-shell/theme/gnome-shell.css". From upgrading to 3.10 and now with 3.12,it seems it doesn't work anymore and so I have to keep large icons on my sh