Finding negative numbers in a field in ILog
I have a following requirement in Ilog Jrules,
Having an Integer field that contains both positive and negative numbers. Requirement is to loop through the Integer field, find and remove the negative sign in the negative numbers. It sounds simple but I could n't find a way to to this.
Any help or pointers would be highly appreciated. Many thanks.
(Supposing that XArray is an input/output Array of Integer in your rule project) You can create a rule like this:
definitions set 'x' to a Number from XArray; if x is less than 0 then set x to -x;
PS: don't forget to add the rule in a ruleTask (with RetePlus Alogorithm: default) in the main ruleflow.
I ve created the following function in BOM to XML mapping and passing all the incoming integer field values through this, which solved the problem.
if (integer < 0) return integer * -1; else return integer;