Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- How to extract formula ??

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 5, 2015 9:38 PM
(341 views)

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, . )

1 REPLY

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 15, 2016 7:57 PM
(244 views)

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 );**

Jim