Announcement

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

    ListGrid.implicitCriteria ignored when value is null in simple criteria

    SmartClient Version: v12.1p_2021-12-17/AllModules Development Only (built 2021-12-17)

    Chrome on MacOS

    Hello, please modify the liveFilter sample like this:

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width: 500, height: 300, alternateRecordStyles: true,
        dataSource: worldDS,
        fields: [
            {name: "countryCode", title: "Code", width: 60},
            {name: "countryName", title: "Country"},
            {name: "capital", title: "Capital"},
            {name: "continent", title: "Continent"}
        ],
        autoFetchData: false,
        showFilterEditor: true,
        filterOnKeypress: true,
        implicitCriteria: {countryCode: null}
    }).fetchData({
        _constructor: "AdvancedCriteria",
        operator: "and",
        criteria: [
            {fieldName: "countryCode", operator: "equals", value: "US"}]
    });
    You'll see that the implicitCriteria is not sent to the server

    #2
    Thanks for the report - we've fixed this for builds dated December 22 and later - advanced-crit works as expected, in the meantime.

    Comment


      #3
      Hello, just to confirm that I see it fixed, thank you very much

      Comment


        #4
        SmartClient Version: v12.1p_2022-03-29/AllModules Development Only (built 2022-03-29)

        Hello, it seems there's a regression, for that exact test case, I see two fetches, the first with criteria:
        Code:
        data:{
                operator:"and",
                criteria:[
                    {
                        fieldName:"countryCode",
                        operator:"equals",
                        value:"US"
                    },
                    {
                        fieldName:"countryCode",
                        operator:"iEquals",
                        value:null
                    }
                ]
            },
        the second:
        Code:
        data:{
                operator:"and",
                criteria:[
                    {
                        fieldName:"countryCode",
                        operator:"equals",
                        value:"US"
                    }
                ]
            },

        Comment


          #5
          We're looking into this and will get back to you shortly.

          Comment


            #6
            Hi Claudio, we're having some trouble figuring out your intent here, and the result of this test case might actually be that it ends up with a warning about a usage issue!

            Specifically, when you use the FilterBuilder, it does substring match. But in your criteria passed to fetchData(), you want "exact" match. That means that criteria couldn't be edited in the FilterEditor unless allowFilterOperators was set, so we can show the user that that field is configured for exact match.

            Then you have countryCode:null in your implicitCriteria. There's no way to interpret that criteria as a substring match since you can't substring match for null, so, that's why it was originally discarded.

            What did you have in mind as the correct result of this code? Perhaps you could adjust it to get rid of the clashing filter operator problem, and it would better reflect a real use case that's broken?

            Comment


              #7
              Hello, actually I don't know if it may be considered a bug, or simply it's a not supported usage, it's just something that I noticed due to a change in behaviour.

              Previously (ie SmartClient Version: v12.1p_2021-12-25/Enterprise Deployment (built 2021-12-25)) a test case like that:

              Code:
              isc.ListGrid.create({
                  ID: "countryList",
                  width: 500, height: 300, alternateRecordStyles: true,
                  dataSource: JPC_COMUNI,
                  fields: [
                      {name: "CODICE_CATASTALE", title: "Code", width: 60},
                      {name: "NOME", title: "Country"}
                  ],
                  autoFetchData: false,
                  showFilterEditor: true,
                  filterOnKeypress: true,
                  implicitCriteria: {NOME: null}
              }).show()
              
              countryList.fetchData({
                  _constructor: "AdvancedCriteria",
                  operator: "and",
                  criteria: [
                      {fieldName: "CODICE", operator: "equals", value: "US"}]
              });
              issued a fetch with this criteria:

              Code:
                  {
                      operator:"and",
                      criteria:[
                          {
                              fieldName:"CODICE",
                              operator:"equals",
                              value:"US"
                          },
                          {
                              fieldName:"NOME",
                              operator:"iEquals",
                              value:null
                          }
                      ]
                  }
              which actually doesn't seem right

              and this query was generated:
              SELECT COUNT(*) FROM DBSALES.JPC_PROVINCE, DBSALES.JPC_COMUNI WHERE
              ('1'='1' AND (LOWER(JPC_COMUNI.NOME)=LOWER('') AND JPC_COMUNI.NOME IS NOT NULL))
              and JPC_COMUNI.FROM_FRM = 'F'
              AND JPC_COMUNI.ID_PROVINCE_FK = JPC_PROVINCE.ID_REC
              which actually it's not what the (simple) implicitCriteria means

              now instead, the generated query is:
              Code:
              SELECT COUNT(*) FROM DBSALES.JPC_PROVINCE, DBSALES.JPC_COMUNI WHERE
                              ('1'='1' AND '1'='1')
                              and JPC_COMUNI.FROM_FRM = 'F'
                           AND JPC_COMUNI.ID_PROVINCE_FK = JPC_PROVINCE.ID_REC
              note: obviously I fixed it with an AdvancedCriteria for the implicitCriteria, but what puzzles me is that isc.DataSource.convertCriteria() doesn't seem able to convert that simple criteria

              Comment

              Working...
              X