Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Business Rule for decimal values

Hello,

 

I'm trying to define a business rule to check if my input is a numeric value or not.

Here's my input:

0683p000009M76E.png

I've applied the next rule in a tMap but unfortunetely it doesn't work (the output gives me zeros):

StringHandling.LEN(out5.Volumen_DM3) > 0 &&
out5.Volumen_DM3.matches("^[0-9]+$")? 1:0

 

In my tMap input this field is defined as a string and the output is an integer since I've established 1 for correct and 0 incorrect.

 

Could anyone help me with this rule?

 

Thank you!!

Marc

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Try "^[0-9,\.]+$" or maybe "^[0-9,\\.]+$"

View solution in original post

6 Replies
TRF
Champion II
Champion II

This one works:

StringHandling.LEN(row1.volume) > 0 && row1.volume.matches("^[0-9,]+$") ? 1 : 0 

Just add a comma into the brackets.

TRF
Champion II
Champion II

Does this help?
If so, thanks to mark your case as solved.
Anonymous
Not applicable
Author

Hello,

 

It works but I have still problems when the input value has a ".", for example: 1.503,67

 

Do you know what I would have to add in order to solve the problem?

 

Thank you!!

TRF
Champion II
Champion II

Try "^[0-9,\.]+$" or maybe "^[0-9,\\.]+$"
Anonymous
Not applicable
Author

It works! Thank you!!

TRF
Champion II
Champion II

You're welcome