Evaluate variable value differently based on context (ref:FleeDataTableCompute)

Jan 27, 2010 at 2:10 PM
Edited Jan 27, 2010 at 2:27 PM


I have a need to evaluate the same variable differently based on the context -  when the ResolveVariableValue event is raised, I would like to know the context in which the value is needed (essentially some information that points to the node that was parsed before, in this case 'sum').

Example expression:   sum(columnName) + columnName

where columnName ==> is a column on a data grid. In the first case, I would like columnName to return an array of all the column values for the DataGrid and in the second case I would like it to just return the selected column value (the code for resolving the selected column value is very similar to the sample code you have put out in the FleeDataTableCompute project).

Is there any way do this?



Feb 3, 2010 at 5:28 PM

Hi again,

I solved the above expression by storing the DataGrid and DataColumn name when ResolveVariable is called and using the ResolveFunction event to pass in those values to the function that is used to compute the sum.

However this really does not work well, because it fails for an expression of the type sum(column1 + column2)!

Is there any other way of working this so it works for all expressions?