Skip to content

Ability to send params in to a custom operator #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
efbenson opened this issue Sep 28, 2018 · 4 comments
Open

Ability to send params in to a custom operator #92

efbenson opened this issue Sep 28, 2018 · 4 comments
Milestone

Comments

@efbenson
Copy link

Ran across a use case where i wanted to know if a date was at least 5 minutes greater than another date. But if I have other cases like 10 minutes then I need to create operators for each test. If I could send in params with the operator it would allow for some pretty flexible conditions.

   {
        fact: 'date1',
        operator: {
                operation: 'dateTime-greater',
                params: {
                      unit: 'minute',
                      quantity: 5
                }
        },
        value: {
            fact: 'date2'
        }
    }
@efbenson efbenson changed the title Ability to send a param in with a custom operator Ability to send params in to a custom operator Sep 28, 2018
@aravindnc
Copy link

Looking forward for an update on this.

@CacheControl
Copy link
Owner

CacheControl commented Dec 13, 2018

@aravindnc One individual requesting a feature doesn't warrant implementation; additional supporting evidence is required. If you'd derive value from this feature and would like to vote for it, please feel free to add a 👍 Alternatively, if your company is in need of this feature and is interested in financing the implementation, that can also be arranged. Finally, if you'd like to take a crack at building this out yourself, I'm happy to help better define the feature and merge a PR.

@aravindnc
Copy link

@CacheControl Cool. Thanks.

@JonSilver
Copy link

@efbenson Without implementing a potentially breaking change to the structure of rule definitions, it would be hard to implement your exact requirement. However if you were to establish your fact differently, reducing your two fact values to just one by performing the calculation yourself before passing the fact to JSON Rules Engine, you could achieve this without any JRE modifications, i.e. date2 - date1 = elapsedTime (ms), so your rule could check elapsedTimeMins greaterThan 5.

@chris-pardy chris-pardy added this to the version 7 milestone Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants