<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />hello everyone ,I have question need you help
firstly I need get the formula of defined column,I use this code,
j=1;
| dt = (Column( j + 92 ) << get formula); |
and next I add a new column , this column use new formula, I need delete the Constant term(not contain "match")
Eval( Eval Expr( dt1 << New Column( "a", Numeric, Continuous, Formula( dt2) ) ) ); //dt1 is current data table;
//dt2 is the formula I need
so ,How can I split the formula, by "+",and only extract the match?
dt=52.6637813873957 + 1.42616433864754 * ((:Menthol - 3900) / 3100) + 0.555650535579654
* ((:WS5 - 1500) / 1500) + (:WS5 - 1500) / 1500 * (:WS5 - 1500) / 1500 * -
2.21892367036055 + (:WS5 - 1500) / 1500 * (:G180 - 100) / 100 * -1.26714026283345 +
(:G180 - 100) / 100 * Match( :Chassis,
"Aqua C", 1.03215142567127,
"CMF", -1.03215142567127,
.
) + (:G180 - 100) / 100 * (:G180 - 100) / 100 * (:G180 - 100) / 100 *
2.31361126928392 + (:WS12 - 750) / 750 * (:WS12 - 750) / 750 * (:WS12 - 750) / 750
* 0.970186120348888 + (:WS5 - 1500) / 1500 * (:G180 - 100) / 100 *
Match( :Chassis, "Aqua C", -1.21032677423725, "CMF", 1.21032677423725, . )
How to extract just this???
dt2=(:G180 - 100) / 100 * Match( :Chassis, "Aqua C", 1.03215142567127,"CMF", -1.03215142567127, .)+(:WS5 - 1500) / 1500 * (:G180 - 100) / 100 *Match( :Chassis, "Aqua C", -1.21032677423725, "CMF", 1.21032677423725, . )
Here is a script that will extract the items you want. I had to use the Eval(Parse(........)) structure because I could not get the script to bring back what I needed when using the variable "i", so I had to force it to be a literal value. But the script works
desired formula = "";
i = 1;
While( Is Empty( Eval( Parse( "arg(dt," || Char( i ) || ")" ) ) ) == 0,
Eval( Parse( "chararg=char(arg(dt," || Char( i ) || "))" ) );
If( Contains( chararg, "Match" ) > 0,
If( desired formula != "",
desired formula = desired formula || " + "
);
desired formula = desired formula || chararg;
);
i++;
);
desired formula = Parse( desired formula );