Announcement

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

    bug in SQL query generated by server side advancedCriteria

    SmartClient Version: v13.0p_2025-01-25/Enterprise Deployment (built 2025-01-25)

    Hi, I just noticed that in the latest 13.0, a server-side criteria constructed like this:

    Code:
     DSRequest dsRequest = new DSRequest("SC_REPORT_ATTIVITA", DataSource.OP_FETCH, rpcManager);
            dsRequest.setAdvancedCriteria(new AdvancedCriteria(DefaultOperators.And, new Criterion[]{
                    new SimpleCriterion("ID_ATTIVITA_FK", DefaultOperators.Equals, DataTools.buildList(1,2)),
                    new SimpleCriterion("TIPO_MANIFESTAZIONE", DefaultOperators.Equals, DataTools.buildList("foo", "bar"))
            }));
            DSResponse dsResponse = dsRequest.execute();
    produces an incorrect query:

    Code:
    SELECT SC_REPORT_ATTIVITA.ID_REC,
           SC_REPORT_ATTIVITA.ID_ATTIVITA_FK,
           SC_REPORT_ATTIVITA.TIPO_MANIFESTAZIONE
    FROM DBJAS.SC_REPORT_ATTIVITA
    WHERE ('0' = '1' AND
           (SC_REPORT_ATTIVITA.TIPO_MANIFESTAZIONE = '[foo, bar]' AND SC_REPORT_ATTIVITA.TIPO_MANIFESTAZIONE IS NOT NULL))
    Last edited by claudiobosticco; 28 Jan 2025, 01:57.

    #2
    Hi claudiobosticco,
    why are you using Equals with a list?
    Shouldn’t it be the InSet then?

    Best regards
    Blama

    Comment


      #3
      Hello Blama, this was previously working, and in the SQL it became (field = 1 OR field = 2), and it's still working like this if the criteria comes from the client, while in 13.1 now I see it's automatically generated with a in clause

      Comment


        #4
        Just a note that a developer is scheduled to look into this. We will report back on this thread soon.

        Comment


          #5
          This issue is now fixed; the fix will be present in 13.0 builds as of tomorrow, February 13. As you note above, the problem is solved in a different way in version 13.1 and greater (the list is converted to an IN () clause), so this is a 13.0-only change. Please let us know if you still see an issue after updating to the fixed build.

          Comment


            #6
            SmartClient Version: v13.0p_2025-02-14/Enterprise Deployment (built 2025-02-14)

            I see it's fixed, thank you very much

            Comment


              #7
              Originally posted by Isomorphic View Post
              As you note above, the problem is solved in a different way in version 13.1 and greater (the list is converted to an IN () clause)
              Hello, I'm not sure if it's related, but I noticed that in 13.1 if I send a criteria from client like:

              Code:
              ds.fetchData({aField: [1,2,3]})
              then in my DMI:

              Code:
              dsRequest.getCriteriaValue("aField")
              returns just 1. This seems a bug, as in previous versions it returned an ArrayList containing the 3 values.

              Comment


                #8
                Hello, may I ask if you see the problem or if I'm missing something?

                Comment


                  #9
                  Sorry for the delay, we are unusually busy at the moment. A developer is assigned to look at your question, we'll respond on this thread soon

                  Comment


                    #10
                    Hello, any news about this issue?

                    Comment


                      #11
                      We are trying to unify behavior in this area across the releases from 13.0 onwards. However, we are unable to verify the claim in your post #7, that calling dsRequest.getCriteriaValue() from a DMI returns just the first entry of a list in this specific case of a fetch with simple criteria sent from the client, in SmartClient 13.1. Can you please confirm you are still seeing this, and if so, provide us with the DMI that demonstrates it, and the "SmartClient Version" string of the build that you are seeing the issue with?

                      Comment


                        #12
                        Hello, this is now working (tested with SmartClient Version: v13.1p_2025-04-02/Enterprise Deployment (built 2025-04-02)), thank you very much!

                        Comment

                        Working...
                        X