>Hello,
> I am having a chance to review a project I just "finished". I wonder if anyone can help me to find a better way to handle the following situation: the project was for an insurance company to calculate and compare different companies' premiums. I used a table called "formula.dbf" to store all the variables and the formulas that I used to calculate each variable in the formula.dbf. Formula.dbf contains these fields: fieldname,formula, condition and active. The codes in the "get_rate" method look like:
> select formula
> go top
> scan while not eof()
> cFieldname = alltrim(fieldname)
> do case
> case cfieldname == "HULL_PREM" AND FORMULA.ACTIVE = .T.
> cWHY = FORMULA.CONDITION
> IF ALLTRIM(cWHY) OR EVALUATE(cWHY)
> cFORMULA = ALLTRIM(FORMULA.FORMULA)
> nHULL_PREM = &cFORMULA
> ENDIF
> case cfieldname == "LIAB_PREM" AND FORMULA.ACTIVE = .T.
> cWHY = FORMULA.CONDITION
> IF ALLTRIM(cWHY) OR EVALUATE(cWHY)
> cFORMULA = ALLTRIM(FORMULA.FORMULA)
> nLIAB_PREM = &cFORMULA
> ENDIF
> ENDCASE
> ENDSCAN
>As you can see, the codes are still considered as hard coded. Things are always change in the insurance industry, I want to find a way that whenever we need to make change to the calculation, we can just add or delete a record from the formula.dbf. Can anyone help.
I would like to see any record's "condition" and "formula" contents from formula before a reply (just as a sample with field types) :)
Cetin