I have two variable and i want to compare it as a string. I use BRANCH and set evaluate labels to “true” and i put relational operator as a condition. But i always got a problem if the value of those 2 variable is a number.
Let say i have below variable:
string1 = 000123
string2 = 123
when i compare it using relational operator %string1%==%string2%, the result is always equals. I read the service development guide and found that it is because wM treating those two value as a number. But what I want is to compare it as a string. I’ve tried using %‘string1’%=%‘string2’% or %“string1”%=%“string2”% as suggested in the guide but still not work.
I’m using wM v9.5.1.0.
Thank you for your fast response.
But my problem is, i unable to do comparison between 2 variable using relational operator %var1%==%var2% if those 2 variable value is a number.
Actually I need to create some validation to compare input from the filename (var1) with the value in database (var2).
So I create one BRANCH and set evaluate labels as true. Inside that BRANCH I put two maps with condition.
the label of first map is using relational operation, %var1%==%var2%, for the second map i’m using $default.
If the value is equal, then it will pass the validation. but if it is not, the it wont pass validation
Result : It will pass the validation, by right it shouldn’t.
I’ve read service development guide for relational operator and found that it is because wM compare those value as a number, so 0001234 is equals to 1234.
This is what i read from the guide
So i change the condition and put quotes as suggested, but it is still not working.
Hope you understand my problem, really sorry if i make you confuse. Still learning.
Yap, i’m planning to create my own java services to do the comparison also.
But I just wonder, in the documentation, it is said that we can make wM to stop from treating the value as a number by using quotes, but when i tried, it can’t. wM still treating the value as a number.
do i miss something??