oldDave
oldDave

Reputation: 405

Drools viable input error

I used SpreadsheetCompiler to extract the drl for my Decision Table. Here is the relevant bit

global Integer netincome;
// rule values at C14, header at C8
rule "Net Income_14"
    salience 65522
    when
        user:CSUserBundle(user.grossHouseholdIncome >= 0, user.grossHouseholdIncome < 1150000, user.grossHouseholdIncome >= 15700*52, user.grossHouseholdIncome < 86600*52)
    then
        netincome = eval(user.grossHouseholdIncome - 0 - (user.grossHouseholdIncome – 816400) * 0.12 - 0)
end

My error is:

E 14:35:30:235 : main : org.drools.compiler.kie.builder.impl.AbstractKieModule : Unable to build KieBaseModel:defaultKieBase
[11,78]: [ERR 101] Line 11:78 no viable alternative at input ''

Unfortunately the column number 78, is in the error is the middle of the 2nd user.grossHouseholdIncome in the 'then' statement. I searched thru the documentation but could not find anything about using a variable name twice in the text. I tried adding the 'eval' in response to De Smet's suggestion for the same error. Any ideas?

Upvotes: 0

Views: 850

Answers (1)

laune
laune

Reputation: 31300

What I did was to copy-paste the rule into a decent text editor and then try to search for all occurrences of special ASCII characters like quote (") or hyphen (-) or anything else the marvellous office programs are apt to convert into some Unicode glyph that sure is looking good but rejected by compilers. Also, do not trust spaces. Frequently they are optical illusions created by a program due to some TAB character. I have replaced the spaces by a single underscore to represent a TAB. And now the 78 aligns exactly with the evil character.

_netincome = eval(user.grossHouseholdIncome - 0 - (user.grossHouseholdIncome – 816400) * 0.12 - 0)
....5...10....5...20....5...30....5...40....5...50....5...60....5...70....5...80

Upvotes: 1

Related Questions