cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to do substring in Business Rules Service?

crashmydev
Explorer
0 Kudos

Hi everyone,

I am implementing some rules from a customer into the business rules service for cloud on CloudFoundry.

Currently, I am struggling with the requirement of the customer to perform a substring on an input value.

For example my Data Object has the field CODE and if some conditions are met, the rule should return:

CODE.substring(3,3) .

Is this somehow possible with the current functionality of Business Rules Service and Expression Language 2.0?

Thanks and kind regards,

Tim

Accepted Solutions (0)

Answers (2)

Answers (2)

Archana
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Tim,

You cannot do substring in business rules. Instead you can use REGEX expression to achieve the same like for example MATCHES '\w{3}5(.*)'

Cocquerel
Active Contributor
0 Kudos

You can find available functions here https://help.sap.com/docs/BUSINESS_RULES/cc9e86e62f754dff82795508324bfd0c/f1d557b2ba30469d97314336f7...

Unfortunately, I do not see any substring function. I guess the workaround would be to add a "calculated" attribute in your data object that provides directly the CODE.substring(3,3) value ready to be consumed by your rule.
Regards,

Michael

crashmydev
Explorer
0 Kudos

Thanks Michael!

I already saw that list, but I hoped that somebody has figured out a way to do it nevertheless.

Kind regards,

Tim