[rules-users] Decision Table: Access values in other columns from a different column

Ramon Buckland ramon at thebuckland.com
Fri Jul 26 07:05:16 EDT 2013


Hi,

I am not sure if you are using Excel to write up the decision tables.. But I found that the Spreadsheet Compiler honours the values that the XLS formulas calculate.

For example: 

If I have a table where the "Row values" start at A20. I can put into A20 .. =$X$1 & "some value" & $Y$2
or 

in A21 .. =A20

Another example, use I made of this was to "=sumif(…)" in one cell (for example B30) , and use the "value" of that in an ACTION call .. 

ACTION

$myobject.setTotal($param)
=B30

Of course the SpreadSheet Compiler is not reading the VBA formulas (Excel formulas), but rather just reading the cached calculated values when the XLS is saved.

Another example of how I used this was; the rules were executed in Stateless fashion, behind a JSON API. The version of the rules (i.e. the spreadsheet) were critical for our API.
So as part of the rule "initialisation" phase, I set the version of the rules (derived from a number on a "non" rules Worksheet in the same XLS) onto an Object.

(an aside : the version looked like: 
400-1371570.025

The "400" is the number of times it has been saved. The other numbers are just UNIX timestamp with a fictional decimal point :-) 
(this number is rewritten via a Macro every time the XLS is "saved") This value, sits in a sheet called "Introduction" at Cell C4. (see below)

AGENDA-GROUP	CONDITION	ACTION
 	$obj : MyVersionObject( )	$obj
 	$1	setRulesVersion("$1")
 	Setting the Version	Set The version
Init	/* yes */	=Introduction!C4


Probably far more info  than you needed .. but there you go.

Ramon Buckland
ramon at thebuckland.com



On 26 Jul 2013, at 11:35, nkhogen <nkhogen at gmail.com> wrote:

> Is there a way to access values in other cells from a different cell of the
> same row in Decision Table? Rewriting of the constants in CONDITION can be
> avoided in the ACTION especially in OR scenario where the facts in the
> activated rules do not have all the constants which are used in comparison.
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/Decision-Table-Access-values-in-other-columns-from-a-different-column-tp4025156.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130726/ce84dec4/attachment-0001.html 


More information about the rules-users mailing list