[rules-users] Inserting Collection into WorkingMemory

Andrew Nguyen andrew-lists-rules-users at na-consulting.net
Thu Jun 11 01:31:25 EDT 2009


I believe the problem is that when you use "SSN == 1234", it is  
looking for a getSSN() function...

Given that your businessData is just a List of Strings, I'm not sure  
there is a good way of getting the SSN out of it.

I had a similar situation and used a Map instead.  So, for your  
businessData, you can try making it a Map and then try the following:

p: ProcessRequest (processType == "Audit" && businessData['SSN'] ==  
"1234")

where businessData is a Map<String, String> and the key, in this case,  
is "SSN" and the value is "1234"

Hope that helps...

--Andrew


On Jun 10, 2009, at 10:21 PM, VinuJay wrote:

>
> Hi my fact object looks like this,
>
> class ProcessRequest {
>
>  Long requestId;
>
>  String processType;
>
>  String assigneeUsers;
>
>  List<String> businessData;
>
>  //Getters and Setters
>
> }
> I have inserted the fact object into working memory in this way
> WorkingMemory workingMemory = ruleBase.newStatefulSession();	
> FactHandle factObject = workingMemory.insert(processRequest );
> workingMemory.fireAllRules();
>
> My question is how to use the values in the business data for  
> comparison in
> the rules.drl file rule "Audit"
> when
> 	p: ProcessRequest(processType == "Audit" && SSN == 1234) then
> 	p.setAssigneeUsers("AuditUser1");
> end
>
> When i try with the above rule it says no field extractor found for  
> SSN, SSN
> is part of the businessdata(List<String>)
>
> Please do suggest me
> 1. How to make the Workingmemory aware of the Collection -  
> businessData 2.
> Change the rules.drl file syntax to access values from Collection.
> -- 
> View this message in context: http://www.nabble.com/Inserting-Collection-into-WorkingMemory-tp23975474p23975474.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



--
Andrew Nguyen
Nguyen & Associates
Custom Software Development & IT Services
http://www.na-consulting.net
andrew at na-consulting.net
858-225-7575




More information about the rules-users mailing list