Bug 742921 - Dependent enumerations not working in Business Rules
Dependent enumerations not working in Business Rules
Status: VERIFIED
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRM (Guvnor) (Show other bugs)
BRMS 5.2.0-ER1
Unspecified Unspecified
unspecified Severity low
: ---
: BRMS 5.3.0.GA
Assigned To: manstis
Lukáš Petrovický
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-03 07:49 EDT by Zuzana Krejčová
Modified: 2016-07-31 21:12 EDT (History)
5 users (show)

See Also:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Zuzana Krejčová 2011-10-03 07:49:38 EDT
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 09:03:35 EDT
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 04:18:41 EDT
BTW, there is no screenshot attached, as you suggest there is.
Comment 5 Zuzana Krejčová 2011-10-12 04:40:38 EDT
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 06:10:42 EDT
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 06:24:08 EDT
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 00:59:27 EDT
    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-15 19:43:39 EST
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-15 20:22:32 EST
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.