Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    'Sort then Grouping' and 'Grouping and then sort' yields different order of result.

    We are using Version v10.1p_2016-03-11/PowerEdition Development Only (2016-03-11)

    Scenario 1
    1.Load the below script
    2. Sort the Last inspection date by asc
    3. Group the date by quarter
    4 you will see the order of Q1, Q2, Q3, Q4

    Scenario 2
    1. Load the script
    2. Group the last inspection date by quarter and then sort by asc
    3. you will see the order of Q1, Q2, Q4, Q3

    Both Grouping order is mismatch.

    <!DOCTYPE html>



    <html>
    <head>


    <title >SNT</title>


    <script type="text/javascript" SRC="http://localhost:7001/CRMApp/isomorphic/system/modules/ISC_Core.js"></script>
    <script type="text/javascript" SRC="http://localhost:7001/CRMApp/isomorphic/system/modules/ISC_Foundation.js"></script>
    <script type="text/javascript" SRC="http://localhost:7001/CRMApp/isomorphic/system/modules/ISC_Containers.js"></script>
    <script type="text/javascript" SRC="http://localhost:7001/CRMApp/isomorphic/system/modules/ISC_Grids.js"></script>
    <script type="text/javascript" SRC="http://localhost:7001/CRMApp/isomorphic/system/modules/ISC_Forms.js"></script>
    <script type="text/javascript" SRC="http://localhost:7001/CRMApp/isomorphic/system/modules/ISC_DataBinding.js"></script>
    <script type="text/javascript" SRC="http://localhost:7001/CRMApp/isomorphic/system/modules/ISC_Drawing.js"></script>
    <script type="text/javascript" SRC="http://localhost:7001/CRMApp/isomorphic/system/modules/ISC_PluginBridges.js"></script>
    <script type="text/javascript" SRC="http://localhost:7001/CRMApp/isomorphic/system/modules/ISC_Charts.js"></script>



    </head>
    <body>

    <br><br>
    <script>

    var isomorphicDir="http://localhost:7001/CRMApp/isomorphic/";

    var data = [
    {inspectorID:12345, region:"United States", state:"Pennsylvania", city:"Pittsburgh", inspections:206,observations:913,lastInspectionDate:new Date(2015, 1, 13),index:52.6, inspectionType: {id:123, name:"type1"}},
    {inspectorID:12345, region:"United States", state:"Pennsylvania", city:"Pittsburgh", inspections:66,observations:null,lastInspectionDate:new Date(2015, 12,2),index:75.3, inspectionType: {id:123, name:"type1"}},
    {inspectorID:88776, region:"United States", state:"Pennsylvania", city:"Pittsburgh", inspections:12,observations:null,lastInspectionDate:new Date(2015,9,3),index:75.3, inspectionType: {id:123, name:"type1"}},
    {inspectorID:44556, region:"United States", state:"Pennsylvania", city:"Butler", inspections:206,observations:12,lastInspectionDate :new Date(2015,4,10),index:52.6, inspectionType: {id:123, name:"type1"}},
    {inspectorID:44556, region:"west States", state:"Pennsylvania", city:"Pittsburgh", inspections:34,observations:0,lastInspectionDate:new Date(2015,2,11),index:52.6, inspectionType: {id:123, name:"type1"}},
    {inspectorID:44556, region:"east States", state:"Pennsylvania", city:"Pittsburgh", inspections:109,observations:null,lastInspectionDate:new Date(2015,11,10),index:52.6, inspectionType: {id:123, name:"type1"}},
    {inspectorID:11111, region:"north States", state:"Pennsylvania", city:"Pittsburgh", inspections:109,observations:null,lastInspectionDate:new Date(2016,7,11),index:52.6, inspectionType: {id:123, name:"type1"}},
    {inspectorID:11111, region:"north States", state:"Pennsylvania", city:"Pittsburgh", inspections:109,observations:null,lastInspectionDate:new Date(2016,1,11),index:52.6, inspectionType: {id:123, name:"type1"}},
    {inspectorID:11111, region:"north States", state:"Pennsylvania", city:"Pittsburgh", inspections:109,observations:null,lastInspectionDate:new Date(2015,7,11),index:52.6, inspectionType: {id:123, name:"type1"}},
    {inspectorID:11111, region:"north States", state:"Pennsylvania", city:"Pittsburgh", inspections:109,observations:null,lastInspectionDate:new Date(2015,8,11),index:52.6, inspectionType: {id:123, name:"type1"}}


    ];

    isc.DataSource.create({
    ID: "ds",
    fields: [
    {name:"inspectorID", title:"Inspector ID", type:"integer" },

    {name:"lastInspectionDate", type:"date", title:"Last Inspection"},
    {name:"region", type:"text", title:"Region"},

    {name:"observations", title:"# Observations", type:"integer"}

    ],
    cacheData:data,
    clientOnly: true
    });

    // create the actual grid object
    var gridObject = isc.ListGrid.create({
    dataSource: ds,
    dataFetchMode : "local",
    autoFetchData: true,
    clientOnly: true,
    width : "100%",
    align : "center",
    autoFitData : "vertical",
    autoFitMaxHeight : 400,
    alternateRecordStyles : true,
    canAddFormulaFields : true,
    canAddSummaryFields : true,
    canGroupBy : true,
    canReorderFields : true,
    showGroupSummary : false,
    groupByMaxRecords : 100,
    canMultiGroup : true,
    useAdvancedFieldPicker : true,
    advancedFieldPickerThreshold : 10
    });

    //gridObject.groupBy(["inspectorID","city"]);

    </script>
    <br><br>

    </body>

    </html>

    #2
    Groups are formed according to the order in which values are encountered in the data, so this is expected.

    You might want to look at listGrid.sortByGroupFirst.

    Comment


      #3
      In this case, the order of data presented to the Grid is as follows.

      02/13/2015
      01/02/2016
      10/03/2015

      05/10/2015
      03/11/2015
      12/10/2015

      08/11/2016
      02/11/2016
      08/11/2015
      09/11/2015

      We apply group then sorting on date column

      Can you pls explain, how the groups formed as Q1, Q2, Q4, Q3. It is not forming as per the data encountered.

      Our internal customer interested in knowing the logic to arrange the groups since there are huge group set

      Comment


        #4
        Any update on this clarification ?

        Comment


          #5
          Grouping logic is applied at the SimpleType level and is specific to the groupingMode - we do see a sorting issue here, with this particular groupingMode, and we're working on fixing it.

          In the meantime - you say that there is a huge group-set, but are you aware that grouping by "Quarter" will only produce 4 groups? That grouping mode is not distinct, so there will be a single Q4, showing data from all years for that quarter. If you really want Quarters for distinct years, you can group by "Quarter and Year" instead, and you should find your sorting then works correctly.

          We'll update on the original problem when we have a fix for it.

          Comment


            #6
            Yes. I am aware that this particular example will produce only 4 quarters. Our users group the data by months and they see the order of grouping name is arranged in different way.

            Comment


              #7
              Just a quick follow-up that we finally tracked this bug down, and it's been fixed in all versions for builds dated May 16 and later.

              Comment

              Working...
              X