the EvaluateExpression function(if its just a straight copy) needs a bit of modification i think.
You will need to add in to it the ability to recognize your variable names and when it finds them use the value from the table. Two ways to do this. One is to have a string parser before hand that goes through the string from the table, and replaces all the variable names with their values. THe other is to attempt to modify ther EvaluateExpression function to recognise the names and get the values itself.
The first solution is probably easiest. Heres a possibly outline psudeo code:
Assumption: All parts of the expression have a space between them, i.e. a + b not a+b
Assumption: A 'word' is a series of non space characters of length one or greater
Hopefully that wont be too hard to implement, and then you can do this
EvaluateExpression (ValueReplace (PSATable!TjFunction))
to get your result
You will need to add in to it the ability to recognize your variable names and when it finds them use the value from the table. Two ways to do this. One is to have a string parser before hand that goes through the string from the table, and replaces all the variable names with their values. THe other is to attempt to modify ther EvaluateExpression function to recognise the names and get the values itself.
The first solution is probably easiest. Heres a possibly outline psudeo code:
Assumption: All parts of the expression have a space between them, i.e. a + b not a+b
Assumption: A 'word' is a series of non space characters of length one or greater
Code:
Private Function ValueReplace(Expression as String) As String
Dim result as string
Do While not end of string
Get next word
If word is variable name then
result = result + (Value of variablename)
Else
result = result + word
End If
Loop
ValueReplace = result
End Function
Hopefully that wont be too hard to implement, and then you can do this
EvaluateExpression (ValueReplace (PSATable!TjFunction))
to get your result