Announcement

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

    requiredCriterion Using OR

    Is it possible to use the requiredCriterion in an operation binding but have it function as an OR? Meaning it has at least 1 of the fields in the list of requiredCriterion?

    https://smartclient.com/smartgwt/jav...uiredCriterion

    #2
    Hi aderosso,

    I don't know how you want to use this (or and "or" version of this), but just as an FYI, this is not a security feature.

    Best regards
    Blama

    Comment


      #3
      Thank you Blama for the info, that post was helpful. Like the other post said, we wanted to utilize something like this just for an extra layer of protection to catch bad requests from the client. The single line in the ds.xml just makes it simpler, but for our use case would require an OR statement. We are doing a similar check in Java directly.

      Comment


        #4
        Just to clarify: you want to require that there is a criterion in this field, but it can be an OR of any non-null value, correct?

        Probably the most compact way to do this is with Server Script (see QuickStart Guide then go from there) - you should be able to address this with just a few lines of code in your preferred language.

        if it’s a recurring requirement that can be captured generically, you could create a subclass of SQLDataSource (or whatever DataSource you are using) that has this behavior automatically attached to specific fields in a declarative manner.

        Comment


          #5
          Isomorphic,

          no, the attribute the OP linked in #1 is on OperationBinding, not on DataSourceField. The suggestion is that any criteria on any attribute listed there should be OK in the requested or-version.
          Right now it's the and-version according to the docs, where there needs to be any criteria for every attribute listed.

          But I assume you suggestion of subclassing SQLDataSource and checking an own attribute there is still the way to go if you don't want to integrate this as feature.

          Best regards
          Blama

          Comment


            #6
            Yes, that correct, you would declare a Server Script on an operationBinding in order to require criteria on a specific field or fields.

            Comment

            Working...
            X