I am using a script to extract a predicted formula from some data that I have, I then modify that formula using substitution and would now like to make a new column using the modified formula. I think this is easy but when I try to script this the formula saved as a variable is not recognized. Any help would be greatly appreciated, please let me know if you need more information as well.
//Script that just shows saving the formula as a variable fm and modifying the variable using substitute to fm2
fm = report(obj1)[OutlineBox("Polynomial ?")][TextEditBox(1)] << get text;
//get the string to the right of the equal sign and convert the string to an expression using Parse()
fm = Parse(Trim(word(2, fm, "=")));
fm2 = Substitute(NameExpr(fm), EvalExpr(LnTime2), EvalExpr(log(Time2)));
//Script to create a new column with the fm2 formula that does not work
dt << New Column( "Predicted", Numeric, Formula (fm2));
//Here is what is returned in the Log when you print fm2 in the script
Print(fm2);
(-0.270568) + 0.0352458 * Log(Time2) - 0.0331127 * (Log(Time2) - 7.22484) ^ 2 + 0.0046766 * (Log(Time2) - 7.22484) ^ 3 + 0.0075752 * (Log(Time2) - 7.22484) ^ 4 + 0.0012501 * (Log(Time2) - 7.22484) ^ 5 + 0.000026534 * (Log(Time2) - 7.22484) ^ 6