Add Favorites to Data Filter with Eval(Substitute(ExprHello,
I have a bug with adding Favorites to Data Filter.
I would like that FAVORITECLAUSE will not be a string but expression (more convenient to maitain).
Please assist.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
FAVORITESCLAUSE = Favorites(
"FAV1"(Match( columns( :age, :sex, :height ),
Where( :age == 14 ), Where( :sex == "M" ),
Where( :height >= 51 & :height <= 60.952 )
)),
"FAV2"(Match( columns( :age, :sex, :height ),
Where( :age == 14 ), Where( :sex == "F" ),
Where( :height >= 51 & :height <= 60.952 )
))
);
Eval(
Substitute(
Expr(
dt << Data Filter(
Location( {-1136, 147} ),
Add Filter(
columns( :age, :sex, :height ),
Display( :age, Size( 178, 102 ), Height( 102 ) )
),
_FAVORITESCLAUSE_
)
),
Expr( _FAVORITESCLAUSE_ ), FAVORITESCLAUSE
)
);
<BR />ScriptingRe: Add Favorites to Data Filter with Eval(Substitute(ExprThank you!
Re: Add Favorites to Data Filter with Eval(Substitute(ExprTry wrapping your FAVORITESCLAUSE in Expr() so it doesn't evaluate immediately, and then use Name Expr() when substituting it in order to add the expression defined by FAVORITESCLAUSE without evaluating it.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
FAVORITESCLAUSE = Expr( Favorites(
"FAV1"(Match( columns( :age, :sex, :height ),
Where( :age == 14 ), Where( :sex == "M" ),
Where( :height >= 51 & :height <= 60.952 )
)),
"FAV2"(Match( columns( :age, :sex, :height ),
Where( :age == 14 ), Where( :sex == "F" ),
Where( :height >= 51 & :height <= 60.952 )
))
) );
Eval(
Substitute(
Expr(
dt << Data Filter(
Location( {-1136, 147} ),
Add Filter(
columns( :age, :sex, :height ),
Display( :age, Size( 178, 102 ), Height( 102 ) )
),
_FAVORITESCLAUSE_
)
),
Expr( _FAVORITESCLAUSE_ ) , Name Expr( FAVORITESCLAUSE )
)
);