Forums / SmartComponent Library - Developer Forum / ablFilter and DECIMAL fields with exact-match queries

ablFilter and DECIMAL fields with exact-match queries

5 posts, 0 answered
  1. Patrik Wikström
    Patrik Wikström avatar
    90 posts
    Registered:
    15 Oct 2018
    04 Nov
    Link to this post

    We hadn't tested this scenario before, so the issue only came up quite late when we encountered a specific use case.

    We needed to perform an exact-match query on a field of type DECIMAL in the backend. The frontend uses . as the decimal separator, while the backend uses ,.
    We noticed that BaseVersion = 2.1 doesn't work, but BaseVersion = 2,1 does.

    While investigating, we found the following code in Service.cls -> FetchDataRequestFromFilter, which seems to be an attempt to handle a similar issue:
    ...
            oEntity:FetchDataset (output dataset-handle hDataset) .
            /* SCL-514: Perform JSON Serialization/Deserialization with AMERICAN
                        numeric format to avoid issues with decimal point interpretation */
            oFormat = SessionHelper:GetNumericFormat() .
            SessionHelper:SetDefaultNumericFormat() .
            lcFilter = pcFilter .
    This raises a few questions

    Is ablFilter expected to support decimal values using . as the separator, or is the 2,1 format the only supported option?

    Could we be missing some localization or numeric format configuration in the backend?
    Or is this something we should handle in the frontend (which seems unlikely)?
    Ideally, we'd like to understand where decimal separator handling is supposed to happen and whether the current behavior is expected or a bug.

  2. Mike Fechner
    Mike Fechner avatar
    375 posts
    Registered:
    14 Sep 2016
    04 Nov in reply to Patrik Wikström
    Link to this post
    • Hi Patrik,

      Thanks for the detailed description.

      To answer your first question: yes, the ablFilter uses the period as the decimal separator. It is a wire format that doesn’t depend on locale. The JSDO builds it from the JavaScript number value, so a filter on 2.1 always arrives as BaseVersion = 2.1, whatever the browser locale. The frontend shouldn’t need to know the numeric format of the backend, and the backend shouldn’t need any extra localization setting for this. So the behaviour you describe, where only 2,1 matches, isn’t what we expect.

      If you see a potential issue there, please log a support ticket at https://www.consultingwerk.com/support/issue-tracking so we can investigate. It would help if the ticket includes:

      the SmartComponent Library version you are on
      the complete filter JSON that the frontend sends (the ablFilter property)
      the numeric format settings of your PASOE agents (-E, -numsep / -numdec in the agent startup parameters, or any code that sets SESSION:NUMERIC-FORMAT)
      the data type and format of the BaseVersion field in the Business Entity temp-table

      Please don’t build your frontend around the 2,1 format in the meantime. It only matches because of the numeric format your backend session uses.

      Best regards,
      Mike
  3. Patrik Wikström
    Patrik Wikström avatar
    90 posts
    Registered:
    15 Oct 2018
    04 Nov in reply to Patrik Wikström
    Link to this post
    Noticed now that we had an own class and override on the method FetchDataRequestFromFilter, might have something to do with this....
  4. Mike Fechner
    Mike Fechner avatar
    375 posts
    Registered:
    14 Sep 2016
    04 Nov in reply to Patrik Wikström
    Link to this post
    In addition in the support ticket, please provide your overriding class (at least the FetchDataRequestFromFilter method) and the reason you needed the override.
  5. Patrik Wikström
    Patrik Wikström avatar
    90 posts
    Registered:
    15 Oct 2018
    04 Nov in reply to Mike Fechner
    Link to this post
    I removed our class from the equation and it still behaves badly so I will open a ticket.
5 posts, 0 answered