We are using a Business rule, which has 1 rule with 3 ORed conditions,
a. If field is empty, it is valid
b. If field found in document cache lookup
c. If field found in database i.e. sql lookup
For these conditions to implment, I need 3 inputs to Business rule i.e. field itself, key returned from cache lookup, key returned from sql lookup.
Now, when I execute this process, before evaluating 3 conditions, Business rule calculates all inputs i.e. it does a cache lookup and it does a sql lookup. And after evaluating inputs, it starts checking conditions.
And these check are executed as i.e.
I. 1st condition met => Accepted
II. 1st conditon fails => check 2nd condition => 2nd condtion met => Acccepted
III. 1st conditon fails => check 2nd condition => 2nd condtion failed => check 3rd => 3rd condtion matched => Acccepted
IV. 1st conditon fails => 2nd condtion failed => 3rd condtion failed => Rejected
Now here, I want to prevent sql lookup (and probably cache lookup too) in scenario I and II where SQL lookup is actually unnecessary i.e. delay input calculation until necessary (Lazy loading).
Is there a way to achieve it?