- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Using variables to create formula columns
For( i = 1, i <= N Items( allm ), i++,
m = allm[i];
name = "Peak Mass " || Char( m );
del = Current Data Table() << delete columns( Char( name ) );
(New Column( Char( name ), set formula( If( subtract(eval(m), 3) < :deltamass <= add(eval(m),3), :pctrelative, 0 ) ) ) ;
If( Contains( name, "Peak Mass 0" ),
del
) ; );
);
Help! I have tried like 5 things, and I can't get my variable to spit out it's numerical value into the column formula.
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Using variables to create formula columns
Most likely something like this:
Eval(EvalExpr(New Column(Char(name), set formula(If(Subtract(Expr(m), 3) < :deltamass <= Add(Expr(m), 3), :pctrelative, 0))));
Wrap New Column() with Eval(EvalExpr()) and replace Eval with Expr() inside it.
-Jarmo
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Using variables to create formula columns
Eval(EvalExpr()) should do the trick
-Jarmo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Using variables to create formula columns
Just suck in where I currently have eval(m)? I just tried that and it is still just putting "Eval Expr(eval(m))" into the column function rather than the numerical value of m.
This post originally written in German and has been translated for your convenience. When you reply, it will also be translated back to German.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Using variables to create formula columns
Most likely something like this:
Eval(EvalExpr(New Column(Char(name), set formula(If(Subtract(Expr(m), 3) < :deltamass <= Add(Expr(m), 3), :pctrelative, 0))));
Wrap New Column() with Eval(EvalExpr()) and replace Eval with Expr() inside it.
-Jarmo