Announcement

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

    AdvancedCriteria generates wrong query

    Hello,

    I recently upgraded from smartGWT 4.1p EE to smartgwtpower-6.0p (SmartClient Version: v11.0p_2016-11-25/PowerEdition Deployment (built 2016-11-25))
    The problem is that the query generated from an AdvancedCriteria is wrong.

    This is the RPC request-response:

    Request: RPCRequest.txtesppmse: RPCResponse.txt

    Why am i getting as response record with PUBLIC_FLG = false and USR_ID = 185 when my request selects the data which has (USR_ID=2044 and PUBLIC_FLG=false) or PUBLIC_FLG=true ?

    This is how i am building the AdvancedCriteria:
    Criterion[] criterions = new Criterion[2];
    criterions[0] = new Criterion("USR_ID",OperatorId.EQUALS,UserContext.getUserId());
    criterions[1] = new Criterion("PUBLIC_FLG",OperatorId.EQUALS,"false");

    AdvancedCriteria usersNonPublic = new AdvancedCriteria(OperatorId.AND,criterions);

    Criterion[] andPublic = new Criterion[2];
    andPublic[0] = usersNonPublic;
    andPublic[1] = new Criterion("PUBLIC_FLG",OperatorId.EQUALS,"true");

    AdvancedCriteria wholeCriteria = new AdvancedCriteria(OperatorId.OR,andPublic);



    And here is the query that is executed (i got the query from server logs):
    SELECT COUNT(*) FROM dbo.SAVE_SRCH LEFT OUTER JOIN USR ON SAVE_SRCH.USR_ID = USR.USR_ID WHERE (((SAVE_SRCH.USR_ID = 2044 AND SAVE_SRCH.USR_ID IS NOT NULL) AND (SAVE_SRCH.PUBLIC_FLG = 0 AND SAVE_SRCH.PUBLIC_FLG IS NOT NULL)) OR (SAVE_SRCH.PUBLIC_FLG = 0 AND SAVE_SRCH.PUBLIC_FLG IS NOT NULL))

    As you can see after the OR statement, it is setting PUBLIC_FLG to 0 instead of 1.

    In smartgwt4.1p EE, this worked perfectly fine.
    Do you have any idea why is this happening?

    #2
    Hi,

    if the flag field is type=boolean in your .ds.xml, try the truth values without ", making them strings.

    Best regards
    Blama

    Comment


      #3
      Thank you very much, sir.
      It worked

      Comment

      Working...
      X