cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

using eval expr() with a column name

fr2007
Level II

can some one help me in using eval expr() function with column name;

example:

column1="names";

eval expr(":"||column1);

is the above evel expr() refers to names column? if so please help me with the syntax..(for referring column names)

3 REPLIES 3
pmroz
Super User


Re: using eval expr() with a column name

You might have better luck with :name("names"), or better yet :name(column1)

jmp_jr
Level III


Re: using eval expr() with a column name

This will get you what you want. . .

column1="names";

var = parse(":"||temp);

However, a better general implementation that will work no matter how the column is named is to use:

var = Parse(":Name(\!"" || (col << Get Name()) || "\!")");

where col is a column reference (if you already have it).  If you don't you can replace the middle part of the concatenation with column1 from above (or the string "names" itself).

jmp_jr
Level III


Re: using eval expr() with a column name

If this question is not answered, I guess I do not understand the question.  Here is another answer . . .

In this case, eval expr() is not working as I would expect.  However, I almost never use eval expr() instead I would write

column1 = "names";

val = Eval(Expr(":" || column1));

If you run this, val = ":names"

Alternatively, you could simply write

val = Eval(":" || column1);

or

val = ":" || column1;

However, if you want to actually refer to the column whose name is "names" then you will have to parse val. . .

val2 = parse(val);

Now you can, for example, get the value in row one of this column by running val2[1].

If your question is not answered at this point, please restate your question.