how to implement not strong typed GetResult

Aug 30, 2007 at 8:43 PM
Hi again, i have some logicx with the CalculationEngine in this way:


ICalculationEngineExpressionOwner expressionOwner = ContextoResolucion();

ExpressionOptions expressionOptions = OpcionesResolucion();

foreach (Concepto concepto in conceptos)
{

motorCalculoExpresiones.Add(concepto.Expresion, expressionOwner, expressionOptions, concepto.Nombre);

motorCalculoExpresiones.Recalculate(concepto.Nombre);

String resultado = motorCalculoExpresiones.GetResult<String>(concepto.Nombre);

conceptosResueltos.Add(concepto, resultado);

}

My problem is 'resultado' is hard typed to String and i need Object, if i use Object i get:
The result type of 'CarpetaFicha' ('String') does not match the supplied type argument ('Object')

The expressions are end-user made using things like dates numbers and string i cannot know the type of the result in advance.

Some idea ?

Coordinator
Aug 30, 2007 at 9:17 PM
I will put in a GetResult method that returns the result as an object.
Aug 31, 2007 at 1:12 AM
what is the best practices to handle DataSet/DataTable/DataRow (typed or untyped) with Flee?

some idea?
Coordinator
Aug 31, 2007 at 3:08 AM
A GetResult that returns an object has been implemented in release 9.0.5.5.
Aug 31, 2007 at 2:14 PM
Thanks !

How affect ExpressionOptions.ResultType to this ?
Coordinator
Aug 31, 2007 at 4:37 PM


eferreyra wrote:
Thanks !

How affect ExpressionOptions.ResultType to this ?


The ResultType determines the type of the expression's result. This is the type that other expressions will see when they reference the original expression in the calculation engine and the actual type that will be returned as an object in the new GetResult method.
Coordinator
Aug 31, 2007 at 4:42 PM


jmptrader wrote:
what is the best practices to handle DataSet/DataTable/DataRow (typed or untyped) with Flee?

some idea?


Really, it's the same as with other types. You declare a variable or field on the owner and then you reference it in the expression. Flee's array indexer can also work with default property indexers so you can say mytable.Rows[0]["columnA"]. The only difference is that for typed datasets, you can just reference the property directly whereas for untyped datasets you have to do some casting.