Announcement

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

    Simple criteria in fetchData and invalidateCache, Advanced Criteria in refreshData

    SmartClient Version: v13.0p_2023-07-04/AllModules Development Only (built 2023-07-04)

    Chrome on MacOS

    Hello, please try this test case:

    Code:
    isc.ListGrid.create({
        ID:"dsListGrid",
        width: "100%",
        height: "100%",
        implicitCriteria:{category:["Account Books", "Glue Sticks"]},
        dataSource: "supplyItem"
    });
    
    dsListGrid.fetchData({units:["Roll", "Ea"]})
    the fetchData method will issue a request with a simple criteria:

    Code:
    {
        dataSource:"supplyItem",
        operationType:"fetch",
        componentId:"dsListGrid",
        data:{
            category:[
                "Account Books",
                "Glue Sticks"
            ],
            units:[
                "Roll",
                "Ea"
            ]
        },
        startRow:0,
        endRow:75,
        textMatchStyle:"exact",
        resultSet:[ResultSet ID:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid)],
        callback:{
            caller:[ResultSet ID:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid)],
            methodName:"fetchRemoteDataReply"
        },
        willHandleError:true,
        showPrompt:true,
        prompt:"Finding Records that match your criteria...",
        oldValues:{
            category:[
                "Account Books",
                "Glue Sticks"
            ],
            units:[
                "Roll",
                "Ea"
            ]
        },
        requestId:"supplyItem$62722",
        internalClientContext:{
            requestIndex:1
        },
        fallbackToEval:false,
        lastClientEventThreadCode:"MUP0",
        bypassCache:true,
        dataProtocol:"getParams"
    }
    However, when calling refreshData, an advanced criteria is used:

    Code:
    {
        dataSource:"supplyItem",
        operationType:"fetch",
        componentId:"dsListGrid",
        data:{
            operator:"and",
            criteria:[
                {
                    operator:"or",
                    criteria:[
                        {
                            fieldName:"category",
                            operator:"iEquals",
                            value:"Account Books"
                        },
                        {
                            fieldName:"category",
                            operator:"iEquals",
                            value:"Glue Sticks"
                        }
                    ]
                },
                {
                    operator:"or",
                    criteria:[
                        {
                            fieldName:"units",
                            operator:"iEquals",
                            value:"Roll"
                        },
                        {
                            fieldName:"units",
                            operator:"iEquals",
                            value:"Ea"
                        }
                    ]
                },
                {
                    operator:"or",
                    criteria:[
                        {
                            fieldName:"category",
                            operator:"iEquals",
                            value:"Account Books"
                        },
                        {
                            fieldName:"category",
                            operator:"iEquals",
                            value:"Glue Sticks"
                        }
                    ]
                }
            ]
        },
        startRow:0,
        endRow:98,
        textMatchStyle:"exact",
        willHandleError:true,
        showPrompt:false,
        oldValues:{
            operator:"and",
            criteria:[
                {
                    operator:"or",
                    criteria:[
                        {
                            fieldName:"category",
                            operator:"iEquals",
                            value:"Account Books"
                        },
                        {
                            fieldName:"category",
                            operator:"iEquals",
                            value:"Glue Sticks"
                        }
                    ]
                },
                {
                    operator:"or",
                    criteria:[
                        {
                            fieldName:"units",
                            operator:"iEquals",
                            value:"Roll"
                        },
                        {
                            fieldName:"units",
                            operator:"iEquals",
                            value:"Ea"
                        }
                    ]
                },
                {
                    operator:"or",
                    criteria:[
                        {
                            fieldName:"category",
                            operator:"iEquals",
                            value:"Account Books"
                        },
                        {
                            fieldName:"category",
                            operator:"iEquals",
                            value:"Glue Sticks"
                        }
                    ]
                }
            ]
        },
        requestId:"supplyItem$62723",
        fallbackToEval:false,
        lastClientEventThreadCode:"TMR3",
        bypassCache:true,
        dataProtocol:"getParams"
    }
    On the other hand, when calling invalidateCache, the former simple criteria is still used.

    Is this the expected behavior?


    #2
    hi Claudio,

    Thanks for the report - the issue here was that refreshData() was combining explicit and implicit criteria too early, and passing it to fetchData(). That criteria-combination is supposed to happen at the last minute, in DataSource fetch code - the result was that the implicitCriteria were added twice, and that caused an unexpected conversion to AdvancedCriteria.

    This same issue was also responsible for your other report about duplicated implicit-criteria.

    We've added a fix and you can try it out in tomorrow's builds, dated July 6.
    Last edited by Isomorphic; 4 Jul 2023, 23:32.

    Comment


      #3
      SmartClient Version: v13.0p_2023-09-01/AllModules Development Only (built 2023-09-01)

      Hello, I forgot to confirm that I see it working now, thank you very much

      Comment

      Working...
      X