ProLiant Servers (ML,DL,SL)
cancel
Showing results for 
Search instead for 
Did you mean: 

Write a function in ILOG and use thar function in a rule's Codition part.

 
VandanaK
Occasional Contributor

Write a function in ILOG and use thar function in a rule's Codition part.

Hi,

I am trying to write a function in ILOG rule file as:
function long getTimeInSeconds(TeMIPAlarmObject ?alarmObj1)
{
String addTextString = ?alarmObj1.additionalText.getString();
int sindex = addTextString.indexOf("XXX-");
int lindex = addTextString.length();
long seconds = 0;
String subAddTextString = addTextString.subString(sindex,lindex);
String target = " ";
for(int i = 5;i {
char ch = subAddTextString.charAt(i);
Character ch1 = ch;

if(ch1.isDigit(ch))
{
target = target.concat(subAddTextString.charAt(i)+"");// +" " is important
//System.out.println(target);
}
else
break;

}

if(!target.equals(" "))
{
try{
seconds = Long.valueOf(target);
//System.out.println(" "+seconds);
//return(seconds);
}catch(Exception ex){

}
}
return(seconds);
}

and I am using this function in rules condition part as:

wait logical until (?alarmObj1.eventTime.getLong() + getTimeInSeconds(?alarmObj1));

It would be great if anyone of u could explain it with example with ILOG syntax,as I am new to ILOG.
Please reply as soon as possible.

thanks