Thanks a ton Thomas!
It solved the problem..
It is working fine now :) :)
Best Regards,
Kripa
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Swindells, Thomas
Sent: Friday, August 20, 2010 3:03 PM
To: Rules Users List
Subject: Re: [rules-users] error while inserting values in excel
That's because you don't have an a, you don't have anything in your condition
column so that column isn't included.
What you need to do is ensure that each column that you want actually contains values and
the condition actually refers to $param.
The simplest way to do this is make your condition basic != $param and put null in as the
row values.
I'm not clear why you have two separate rules for PF and HRA? You could just as easily
do this in a single rule?
Thomas
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Kripa Nathwani
Sent: 20 August 2010 10:22
To: Rules Users List
Subject: Re: [rules-users] error while inserting values in excel
Hi,
PFA newly modified DT and corresponding POJO as you have asked for.
CONDITION which we have applied on basic is such that I have to check 'if value passed
to basic variable is null(i.e. no value has been passed from calling code i.e. main
method pasted below). We have written such a CONDITION because we wanted that rule should
fire only when some value has been set to basic variable from calling method and also I
have changed data type of basic to Integer as you had asked for.
Calling program :
public static final void main(String[] args) {
try {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger =
KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// go !
AmountPojo a = new AmountPojo();
a.setBasic(1000);
ksession.insert(a);
ksession.fireAllRules();
logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
But,still we are getting error as 'a can not be resolved' and this error is
occurring on lines 5(occurrence is 3 times) and 14 (occurrence is 3 times). To my
surprise, I found that these rows (i.e. row no.5 and 14) are blank.
Please suggest some solution for the same
Best Regards,
Kripa
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Swindells, Thomas
Sent: Friday, August 20, 2010 1:55 PM
To: Rules Users List
Subject: Re: [rules-users] error while inserting values in excel
You class looks totally wrong!
What are you using statics? These should all just be instant variables (as you are trying
to get a - an instance of AmountProj).
If you want to have nullable values then you can't use primitives, you need to use the
Object forms (java.lang.Double, java.lang.Integer).
The syntax of your rules are wrong as well. Your should merge the a: AmountPair across all
your condition columns so that you are using the same a.
Your condition expressions are also wrong - you should be using mvel not java style code
and you should be using the column value.
This means that your expression should look like "basic == $param" (this would
test that the basic salary matches whatever is in the corresponding column.
If you just want the rule to run always as long as basic isn't null (assuming
you've done the fixes above) then the simplest way is to have teh expression
"basic != $param" and then place null in the column, although I think you need
to explain a bit more of what you are trying to achieve as I'm not sure why you are
trying to do this in a spreadsheet?
Thomas
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Kripa Nathwani
Sent: 20 August 2010 08:36
To: Rules Users List
Subject: Re: [rules-users] error while inserting values in excel
Hi,
The foll is the java file which I tried to run as a stand alone application:
package com.sample;
public class AmountPojo {
public static int basic;
public static double pf;
public static double hra;
public static int getBasic() {
return basic;
}
public static void setBasic(int basic) {
AmountPojo.basic = basic;
}
public static double getPf() {
return pf;
}
public static void setPf(double pf) {
AmountPojo.pf = pf;
}
public static double getHra() {
return hra;
}
public static void setHra(double hra) {
AmountPojo.hra = hra;
}
}
Let me know if you still require any further information.
Regards,
Kripa
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of tom ska
Sent: Friday, August 20, 2010 12:42 PM
To: Rules Users List
Subject: Re: [rules-users] error while inserting values in excel
Ok, please write me AmountPojo class code, and - if You can - those rules in DRL, I will
try to write You rules in DT.
regards,
tom
2010/8/20 Kripa Nathwani
<Kripa.Nathwani@lntinfotech.com<mailto:Kripa.Nathwani@lntinfotech.com>>
Hi,
Below is the decision table on which I am working. It is calculating PF and HRA by taking
basic value and checking that basic is not equal to null.
The problem is when I start inserting values in the column it is giving me following error
messages:
no viable alternative at input ')' in rule "Pricing bracket_12" in
pattern AmountPojo
mismatched input '!=' expecting ')' in rule "Pricing
bracket_12" in pattern AmountPojo
Unknown error while parsing. This is a bug. Please contact the Development team
I know it is related to syntax but I am not able to solve it.
[cid:image001.png@01CB407A.E95216D0]
Best Regards,
Kripa
________________________________
This Email may contain confidential or privileged information for the intended recipient
(s) If you are not the intended recipient, please do not use or disseminate the
information, notify the sender and delete it from your system.
______________________________________________________________________
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users
______________________________________________________________________
________________________________
This Email may contain confidential or privileged information for the intended recipient
(s) If you are not the intended recipient, please do not use or disseminate the
information, notify the sender and delete it from your system.
______________________________________________________________________
________________________________
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received
this message in error, please immediately notify the postmaster(a)nds.com and delete it from
your system as well as any copies. The content of e-mails as well as traffic data may be
monitored by NDS for employment and security purposes. To protect the environment please
do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United
Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603
8808 40-00
**************************************************************************************
______________________________________________________________________
________________________________
This Email may contain confidential or privileged information for the intended recipient
(s) If you are not the intended recipient, please do not use or disseminate the
information, notify the sender and delete it from your system.
______________________________________________________________________
________________________________
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received
this message in error, please immediately notify the postmaster(a)nds.com and delete it from
your system as well as any copies. The content of e-mails as well as traffic data may be
monitored by NDS for employment and security purposes. To protect the environment please
do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United
Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603
8808 40-00
**************************************************************************************
______________________________________________________________________
________________________________
This Email may contain confidential or privileged information for the intended recipient
(s) If you are not the intended recipient, please do not use or disseminate the
information, notify the sender and delete it from your system.
______________________________________________________________________