Bug 742921 - Dependent enumerations not working in Business Rules
Summary: Dependent enumerations not working in Business Rules
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRM (Guvnor)
Version: BRMS 5.2.0-ER1
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: BRMS 5.3.0.GA
Assignee: manstis
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-10-03 11:49 UTC by Zuzana Krejčová
Modified: 2023-05-15 19:53 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
When using the guided template editor to add a rule that uses dependent enumeration instead of being able to select from a drop down menu an editable plain textbox was provided. An enumeration drop down menu has been added to resolve the issue.
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
rule with a dependent enumeration (12.14 KB, image/png)
2011-10-12 08:40 UTC, Zuzana Krejčová
no flags Details

Description Zuzana Krejčová 2011-10-03 11:49:38 UTC
Description of problem:
Dependent enumerations are not working in Business rules - Guided editor. Instead of a drop-down list with the dependent values, only an editable text box is shown.


Model used:
declare fact
	f1: String
	f2: String
end

Enumeration:
'fact.f1' : ['a','b']
'fact.f2[f1=a]' : ['a1', 'a2']
'fact.f2[f1=b]' : ['b1', 'b2']

The screenshot shows the rule.
 


Version-Release number of selected component (if applicable):
BRMS 5.2.0 ER5


Additional info:
In Test Scenarios, dependent enumerations seem to work just fine.

Comment 1 Zuzana Krejčová 2011-10-03 13:03:35 UTC
After playing a bit with test scenarios, I found out that:

If you insert a given fact (see above for the model and enumeration),
- any enum value you want has to be first selected, otherwise, Guvnor thinks it's null. This means, for the "default" value in the dropdown, you have to select something else and then select the default again. You have to confirm your choice by saving the test scenario.
- the depending enum value works the same as above. The dropdown list with the correct values is shown after "correctly" selecting and confirming the first value (the one it depends on).
- save, save again and save... makes it safe to use ;) Using Facts with enumerations the above mentioned way makes it work, the right rules are fired.


Even if the dependent enumerations don't work in business rules, you can type the appropriate field value into the dependent field edit box. You just have to know what you want in there...

Comment 4 manstis 2011-10-12 08:18:41 UTC
BTW, there is no screenshot attached, as you suggest there is.

Comment 5 Zuzana Krejčová 2011-10-12 08:40:38 UTC
Created attachment 527624 [details]
rule with a dependent enumeration

Sorry, forgot to post it, though it's a really simple rule anyway. 
Green rectangle shows the basic enum, that works fine. Orange rect. is the dependent enum - only 'b1' or 'b2' should be allowed in there... 
I added the dependent field after choosing value for the first field.

Comment 6 manstis 2011-10-12 10:10:42 UTC
No problem, I guessed as much. I've fixed what you reported here, but I notice another issue - in Test Scenarios if you change the value of the parent dependent enum (f1, in your example) the options for f2 do not update - you need to delete f2 and re-add it. To prevent this BZ becoming an umbrella for other issues, can you please create a new ticket for this behaviour (and take it through the 5.3 triage process)?

Comment 7 Zuzana Krejčová 2011-10-12 10:24:08 UTC
Thanks. I think the issue you mentioned has already been reported somewhere, hence why I didn't look into it too much. I'll do a search and make a new BZ if I can't find it.

Comment 12 lcarlon 2012-06-01 04:59:27 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When using the guided template editor to add a rule that uses dependent enumeration instead of being able to select from a drop down menu an editable plain textbox was provided. An enumeration drop down menu has been added to resolve the issue.

Comment 13 Rares Vernica 2015-01-16 00:43:39 UTC
This bug seems to be present in kie-drools-wb-distribution-wars-6.1.0.Final-tomcat7.0.war

Comment 14 Rares Vernica 2015-01-16 01:22:32 UTC
It seems that it does not work if the enumeration is defined like this:

'fact.f2[ f1=a ]' : ['a1', 'a2']


Notice the " "(blank space) between "f2[" and "f1=a"

The documentation uses blank spaces in the examples: http://docs.jboss.org/drools/release/6.1.0.Final/drools-docs/html_single/index.html#drools.AdvancedEnumConcepts


Note You need to log in before you can comment on or make changes to this bug.