I am using KIE Workbench (version 7.0.0.Final) to create rules using Guided editor. I am perfectly able to create the rules with .drl files but am having issues creating the same rules with the editor. Consider the below examples:
I have created the below rule in editor which translates to this in the "Source" tab:
package com.myteam.orica;
import java.lang.String;
rule "Home Phone"
dialect "java"
when
sampleAttributes : SampleAttributes( homePhoneNumber : homePhoneNumber != null )
then
sampleAttributes.setHomePhoneNumber( homePhoneNumber.replaceAll( "[^\\d]", "" ) );
end
Ideally, I want it to be something like this:
package com.myteam.orica;
import java.lang.String;
rule "Home Phone"
dialect "java"
when
sampleAttributes : SampleAttributes( homePhoneNumber : homePhoneNumber != null )
then
String str = homePhoneNumber.replaceAll( "[^\\d]", "" );
sampleAttributes.setHomePhoneNumber( str );
end
basically store the result of the method call (replaceAll) on homePhoneNumber to a temp/local variable which I can then set as a part of homePhoneNumber attribute of my SampleAttributes DataObject, but to be done with the Guided editor. I have tried using the Global variables, but am not able to set it in the editor.
Can someone please let me know how can I achieve the above with the Guided rule editor?
Thanks