[rules-users] question - using 'or' to concatenate _different_ field constraint s

Olenin, Vladimir (MOH) Vladimir.Olenin at moh.gov.on.ca
Tue Mar 27 10:52:30 EDT 2007


Hi,

 

I wonder if this is possible in the current 3.1M release (or will be
possible in the 3.2 final).... I need to concatenate field constraints with
'or' logic, so smth like:

 

Record (fieldAsString matches "[xyz]" or fieldAsInt > 1, $myOtherField :
myOtherField)

 

The above is just to illustrate an idea (ie, the case above can easily be
written as 'or' concatenation of column constraints). My 'record' object is
far more complex. Moreover, the column concatenation logic can  contain over
4 different columns. Also, I need to use field binding on the matched
columns, eg:

 

Record (fieldAsString matches "[xyz]" or fieldAsInt > 1, $myOtherField :
myOtherField)

Record ($field : field, fieldAsString matches "[xyz]" or fieldAsInt > 1,
myOtherField == $myOtherField)

Record (field == $field)

 

Basically the idea is that I need to define both 'string' and 'number'
constraints on a field. Eg, if 'field' value can be a number "1234567", then
constrains I want to have might be:

-          field (as string) matches "123[0-9]{3}7"

-          field (as int) > 1230000

 

To do this I have different getters in my fact object linked to the same
field:

 

Class Record {

  String field;

 

  Public String getFieldAsString() {

    Return field;

  }

 

  Public int getFieldAsInt() {

    Return Integer.parseInt(field);

  }

 

  Public String getField() {

    Return field;

  }

}

 

I believe such thing is not possible to do with current implementation. If
not, is it planned for? If not, should it be planned for? It seems like a
very valid use case, since there is a set of applications where business
analysts want to define constraints as a combination of field as a string
pattern AND field as a number (in my particular example - constrains on
account numbers. The pattern is used to define 'account types', while
numeric range is used to define particular organizations with the account
type)

 

Thanks,

 

Vlad

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070327/94ed0186/attachment.html 


More information about the rules-users mailing list