If you'll pardon the heresy... It sounds to me like the whole thing can be solved with an appropriately loaded hashtable without any need for a rules engine at all!
Chris On 19/06/2012 11:54, Wolfgang Laun wrote: > On 19/06/2012, zeeshan <zeeshan.spr...@gmail.com> wrote: >> Hi Laune, >> >> >> >> Thanks very much for your response. We would like to try and implement >> Option 3. >> >> We assume that the implementation involves setting up individual rows in >> the >> excel as a collection of objects and using the From keyword to look up the >> output value/row we want based on the input parameter values. > Huh? You leave the Excel data as it is except for throwing away the > header lines. > >> Is it >> possible for you to share the relevant code you have created to implement >> this option? > This is the rule: > > rule calculatePremium > when > $pfc: PremiumCalculatorFactBean( $age: age, > $policyTerm: policyTerm, > $interestRate: interestRate, > $gender: gender, > $smokingStatus: smokingStatus, > $channel: channel, > premiumRate == 0.0 ) > $p: Premium( age == $age, > policyTerm == $policyTerm, > interestRate == $interestRate, > gender == $gender, > smokingStatus == $smokingStatus, > channel == $channel ) > then > modify( $pfc ){ setPremiumRate( $p.getPremiumRate() ) } > end > > > And a few lines of Java code: > > private void makeRates( String csvPath ) throws Exception { > File f = new File( csvPath ); > InputStream is = new FileInputStream( f ); > Reader rdr = new InputStreamReader( is ); > LineNumberReader lnrdr = new LineNumberReader( rdr ); > > String line; > while( (line = lnrdr.readLine()) != null ){ > if( line.charAt(0) == '"' ) continue; > String[] tokens = line.split( ";" ); > if( tokens.length != 7 ) continue; > int age = Integer.parseInt( tokens[0] ); > int policyTerm = Integer.parseInt( tokens[1] ); > int interestRate = Integer.parseInt( tokens[2] ); > String gender = tokens[3].substring( 1, 2 ); > String smokingStatus = tokens[4].substring( 1, 2 ); > int channel = Integer.parseInt( tokens[5] ); > double premiumRate = Double.parseDouble( tokens[6] ); > > Premium p = new Premium( age, policyTerm, interestRate, > gender, smokingStatus, channel, premiumRate ); > kSession.insert( p ); > } > close( rdr ); > } > > -W > > >> Thanks ! >> >> >> -- >> View this message in context: >> http://drools.46999.n3.nabble.com/Hibernate-Configuration-with-Drools-5-4-tp4017981p4018051.html >> Sent from the Drools: User forum mailing list archive at Nabble.com. >> _______________________________________________ >> rules-users mailing list >> rules-users@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/rules-users >> > _______________________________________________ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users