cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar

Why is it this doesn't work?

:Name("COLUMN_NAME+WITH-CHARACTERS")

OK

str = "COLUMN_NAME+WITH-CHARACTERS"

:Name(str)

Error: Name arg must be quoted string

The only way I've gotten this to work is:

eval(parse(":Name(\!""||str||"\!")"))

which is absurd

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Why is it this doesn't work?

I use the column function instead:

column(str)

For clarity I include the dataset name as well:

column(dt, str)

Sometimes I've needed to use the as column function.  Not sure if it applies here.

Regards,

Peter

View solution in original post

5 REPLIES 5
pmroz
Super User

Why is it this doesn't work?

I use the column function instead:

column(str)

For clarity I include the dataset name as well:

column(dt, str)

Sometimes I've needed to use the as column function.  Not sure if it applies here.

Regards,

Peter

ccp
ccp
Level I

Why is it this doesn't work?

Hi,

Can you also add some info on the usage of "As Column"? I am trying to pass a column name as a variable to the Split Table function, and I think the "As Column" function will help me do this. What I am trying looks something like this:

columnname = "data1"; // assume there are multiple columns of data like this, data2, data3, etc.

Current  Data Table () << Split ( Split By (:DAY) ), Split (columnname) .... );

I think I need something like an As Column (columnname); statement in there...

Suggestions?

Thanks,

Charles

pmroz
Super User

Why is it this doesn't work?

I'm not sure why you need COLUMN vs AS COLUMN.  It seems to clarify things for JMP.  I mostly use the COLUMN function, but I needed to use the AS COLUMN function in a where clause:

one_dme = "Electrolysis";

tmp_matrix = dmt << get rows where(:Time Period == "Current"

                                   & as column(dmt, eval(one_dme)) == 1);

ccp
ccp
Level I

Why is it this doesn't work?

@PMroz

Thanks for your help. I could not get As Column to do anything for me, but your use of "eval" got me thinking, and I was able to get this syntax to work:

columnname = "data1";

Current  Data Table () << Split ( Split By (:DAY) ), Split (eval(columnname)) .... );

Thanks,

Charles

XanGregg
Staff

Why is it this doesn't work?

FYI, Name() isn't a real function (despite the way it looks); it's a quoting mechanism handled by the parser. If you really want to create a name at run-time, use the As Name() function.