Announcement

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

    not really well composed but legal AdvancedCriteria gives strange behaviour in 12.1

    SmartClient Version: v12.1p_2022-11-16/Enterprise Development Only (built 2022-11-16)

    Chrome on MacOS Ventura

    Hello, I just noticed that an AdvancedCriteria, which was not really well composed (it was constructed dynamically in javascript), gives a different behaviour in recent 12.1 builds vs 13.0.

    I don't know if it's a symptom of an actual problem, as the fix in the application is trivial, but I want to report it nevertheless.

    Please modify the comboComboBoxStyled sample like this:

    Code:
    isc.DynamicForm.create({
        ID: "testForm",
        width: 500,
        items: [
            {
                name: "itemName", title: "Item Name", editorType: "ComboBoxItem", valueField: "itemID",
                addUnknownValues: false,
                optionDataSource: "supplyItem",
                width: 250,
                pickListCellHeight: 50,
                pickListProperties: {
                    canHover: true,
                    showHover: true,
                    cellHoverHTML: function (record) {
                        return record.units;
                    },
                    formatCellValue: function (value, record, field, viewer) {
                        var descStr = record.units;
                        var styleStr = "font-family:arial;font-size:11px;white-space:nowrap;overflow:hidden;";
                        var retStr = "<table>" +
                            "<tr><td ><span style='" + styleStr + "width:170px;float:left'>" + record.itemName + "<span></td>" +
                            "<td align='right'><span style='" + styleStr + "width:50px;float:right;font-weight:bold'>" + record.unitCost + "<span></td></tr>" +
                            "<tr><td colSpan=2><span style='" + styleStr + "width:220px;float:left'>" + descStr + "</span></td></tr></table>";
                        return retStr;
                    }
                },
                getPickListFilterCriteria: function () {
                    return {
                        _constructor: "AdvancedCriteria",
                        operator: "or",
                        criteria: [
                            {
                                operator: "and",
                                criteria: [
                                    {
                                        fieldName: "units",
                                        operator: "equals",
                                        value: "Roll"
                                    }
                                ]
                            }
                        ]
                    };
                }
            }]
    });
    using v12.1p_2022-11-16 the DSRequest that I see in the RPC tab, when I open the picklist, is:

    Code:
    {
        dataSource:"supplyItem",
        operationType:"fetch",
        componentId:"isc_PickListMenu_0",
        data:{
            operator:"and",
            criteria:[
                {
                    fieldName:"units",
                    operator:"equals",
                    value:"Roll"
                }
            ]
        },
        startRow:0,
        endRow:75,
        textMatchStyle:"startsWith",
    ....
    and this is what I see in the tomcat logs:

    Code:
    === 2022-11-18 11:17:55,045 [ec-7] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36': Safari with Accept-Encoding header
    === 2022-11-18 11:17:55,278 [ec-7] INFO IDACall - Performing 1 operation(s) [UA: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36]
    === 2022-11-18 11:17:55,281 [ec-7] INFO DSRequest - Executing isc_PickListMenu_0->supplyItem.fetch rows: 0->75 with
    criteria: {
        operator:"and",
        criteria:[
            {fieldName:"units", operator:"equals", value:"Roll"}
        ]
    }
    === 2022-11-18 11:17:55,305 [ec-7] INFO SQLDriver - Executing SQL query on 'HSQLDB':
        SELECT
            COUNT(*)
        FROM
            supplyItem
    === 2022-11-18 11:17:55,321 [ec-7] INFO SQLDataSource - 1152: Executing query on 'HSQLDB':
        SELECT
            LIMIT 0 75 supplyItem.itemID, supplyItem.itemName, supplyItem.SKU, supplyItem.description, supplyItem.category, supplyItem.units, supplyItem.unitCost, supplyItem.inStock, supplyItem.nextShipment
        FROM
            supplyItem
        WHERE
            (
                '1'='1'
            )
    === 2022-11-18 11:17:55,334 [ec-7] INFO DSResponse - DSResponse: List with 75 items
    === 2022-11-18 11:17:55,352 [ec-7] INFO Compression - /isomorphic/IDACall: 12,3k -> 2,8k
    the criteria lacks the _constructor attribute, so it isn't treated as an AdvancedCriteria (and so it's ignored).

    Instead using
    SmartClient Version: v13.0p_2022-11-16/Enterprise Development Only (built 2022-11-16)
    the DSRequest in the RPC tab is the same, but the tomcat logs are different:

    Code:
    === 2022-11-18 12:49:28,379 [ec-5] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36': Safari with Accept-Encoding header
    === 2022-11-18 12:49:28,520 [ec-5] INFO IDACall - Performing 1 operation(s) [UA: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36]
    === 2022-11-18 12:49:28,521 [ec-5] INFO DSRequest - Executing isc_PickListMenu_0->supplyItem.fetch rows: 0->75 with
    criteria: {
        operator:"and",
        criteria:[
            {fieldName:"units", operator:"equals", value:"Roll"}
        ]
    }
    === 2022-11-18 12:49:28,521 [ec-5] INFO AdvancedCriteria - Criteria object:{
        operator:"and",
        criteria:[
            {
                fieldName:"units",
                operator:"equals",
                value:"Roll"
            }
        ]
    } not explicitly marked as AdvancedCriteria but treating as Advanced based on format.
    === 2022-11-18 12:49:28,521 [ec-5] INFO AdvancedCriteria - Criteria object:{
        operator:"and",
        criteria:[
            {
                fieldName:"units",
                operator:"equals",
                value:"Roll"
            }
        ]
    } not explicitly marked as AdvancedCriteria but treating as Advanced based on format.
    === 2022-11-18 12:49:28,526 [ec-5] INFO SQLDriver - Executing SQL query on 'HSQLDB':
        SELECT
            COUNT(*)
        FROM
            supplyItem
        WHERE
            (
                (
                    supplyItem.units = 'Roll'
                    AND supplyItem.units IS NOT NULL
                )
            )
    === 2022-11-18 12:49:28,533 [ec-5] INFO SQLDataSource - 514: Executing query on 'HSQLDB':
        SELECT
            LIMIT 0 75 supplyItem.itemID, supplyItem.itemName, supplyItem.SKU, supplyItem.description, supplyItem.category, supplyItem.units, supplyItem.unitCost, supplyItem.inStock, supplyItem.nextShipment
        FROM
            supplyItem
        WHERE
            (
                (
                    supplyItem.units = 'Roll'
                    AND supplyItem.units IS NOT NULL
                )
            )
    === 2022-11-18 12:49:28,538 [ec-5] INFO DSResponse - DSResponse: List with 75 items
    === 2022-11-18 12:49:28,544 [ec-5] INFO Compression - /isomorphic/IDACall: 13,2k -> 3,0k
    so it's indeed treated as and advanced criteria, as the logs say "not explicitly marked as AdvancedCriteria but treating as Advanced based on format". It was also the case with older 12.1 builds.


    #2
    The intended behavior is the one you're showing for 13.0 - the server is supposed to heuristically figure out that the criteria must be AdvancedCriteria, even if it's not explicitly marked.

    However, can you clarify what you're saying about 12.1 - it seems like you're saying that older 12.1 builds also treated the criteria as advanced, but newer 12.1 builds do not?

    Also, is it exactly the same DataSource? Because the heuristics take into account the fields of the DS, for example, if you actually declare a field called "operator" then something that looks a bit like AdvancedCriteria might actually be valid as simple criteria, for that particular DataSource.

    Comment


      #3
      Originally posted by Isomorphic View Post
      However, can you clarify what you're saying about 12.1 - it seems like you're saying that older 12.1 builds also treated the criteria as advanced, but newer 12.1 builds do not?

      Also, is it exactly the same DataSource?
      Yes, same dataSource (supplyItem in the showcase comboListComboBox sample), and yes, build v12.1p_2022-11-16 do not treat the criteria as advanced, this is the tomcat log (from the showcase):

      Code:
      === 2022-11-18 11:17:55,045 [ec-7] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36': Safari with Accept-Encoding header
      === 2022-11-18 11:17:55,278 [ec-7] INFO IDACall - Performing 1 operation(s) [UA: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36]
      === 2022-11-18 11:17:55,281 [ec-7] INFO DSRequest - Executing isc_PickListMenu_0->supplyItem.fetch rows: 0->75 with
      criteria: {
          operator:"and",
          criteria:[
              {fieldName:"units", operator:"equals", value:"Roll"}
          ]
      }
      === 2022-11-18 11:17:55,305 [ec-7] INFO SQLDriver - Executing SQL query on 'HSQLDB':
          SELECT
              COUNT(*)
          FROM
              supplyItem
      === 2022-11-18 11:17:55,321 [ec-7] INFO SQLDataSource - 1152: Executing query on 'HSQLDB':
          SELECT
              LIMIT 0 75 supplyItem.itemID, supplyItem.itemName, supplyItem.SKU, supplyItem.description, supplyItem.category, supplyItem.units, supplyItem.unitCost, supplyItem.inStock, supplyItem.nextShipment
          FROM
              supplyItem
          WHERE
              (
                  '1'='1'
              )
      === 2022-11-18 11:17:55,334 [ec-7] INFO DSResponse - DSResponse: List with 75 items
      === 2022-11-18 11:17:55,352 [ec-7] INFO Compression - /isomorphic/IDACall: 12,3k -> 2,8k
      with an older build:
      SmartClient Version: v12.1p_2022-03-05/Enterprise Development Only (built 2022-03-05)
      the behaviour is not exactly the same as the 13.0, the DSRequest in the RPC tab is different:

      Code:
      {
          dataSource:"supplyItem",
          operationType:"fetch",
          componentId:"isc_PickListMenu_0",
          data:{
              operator:"or",
              criteria:[
                  {
                      operator:"and",
                      criteria:[
                          {
                              fieldName:"units",
                              operator:"equals",
                              value:"Roll"
                          }
                      ]
                  }
              ]
          },
          startRow:0,
          endRow:75,
          textMatchStyle:"startsWith",
      as you can see, the criteria retains the outer "or" (which actually is useless), and in the tomcat logs the criteria has the attribute _constructor and the resulting query has the same where condition as the 13.0 build.

      Code:
      === 2022-11-18 19:56:24,700 [ec-6] INFO RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36': Safari with Accept-Encoding header
      === 2022-11-18 19:56:24,764 [ec-6] INFO IDACall - Performing 1 operation(s) [UA: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36]
      === 2022-11-18 19:56:24,764 [ec-6] INFO DSRequest - Executing isc_PickListMenu_0->supplyItem.fetch rows: 0->75 with
      criteria: {
          _constructor:"AdvancedCriteria",
          operator:"or",
          criteria:[
              {
                  operator:"and",
                  criteria:[
                      {fieldName:"units", operator:"equals", value:"Roll"}
                  ]
              }
          ]
      }
      === 2022-11-18 19:56:24,766 [ec-6] INFO SQLDriver - Executing SQL query on 'HSQLDB':
          SELECT
              COUNT(*)
          FROM
              supplyItem
          WHERE
              (
                  (
                      (
                          supplyItem.units = 'Roll'
                          AND supplyItem.units IS NOT NULL
                      )
                  )
              )
      === 2022-11-18 19:56:24,772 [ec-6] INFO SQLDataSource - 1152: Executing query on 'HSQLDB':
          SELECT
              LIMIT 0 75 supplyItem.itemID, supplyItem.itemName, supplyItem.SKU, supplyItem.description, supplyItem.category, supplyItem.units, supplyItem.unitCost, supplyItem.inStock, supplyItem.nextShipment
          FROM
              supplyItem
          WHERE
              (
                  (
                      (
                          supplyItem.units = 'Roll'
                          AND supplyItem.units IS NOT NULL
                      )
                  )
              )
      === 2022-11-18 19:56:24,776 [ec-6] INFO DSResponse - DSResponse: List with 75 items
      === 2022-11-18 19:56:24,780 [ec-6] INFO Compression - /isomorphic/IDACall: 13,2k -> 3,0k
      Last edited by claudiobosticco; 18 Nov 2022, 12:11.

      Comment


        #4
        Ah, OK, so to sum up:

        1. the 12.1 server does not do heuristic AdvancedCriteria detection, and you've seen no change here

        2. the 12.1 client side changed somewhere in the last 8 months, such that in this circumstance, it sends simplified criteria. However that simplified criteria drops the explicit AdvancedCriteria marker.

        #2 was probably the inadvertent result of a bugfix, we'll check it out, thanks for the report.

        Comment


          #5
          This is fixed and is available for download in nightly builds since Nov 26.

          Comment


            #6
            Hello, thanks but the latest build available for 12.1 is Nov 25

            Comment

            Working...
            X