cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
abdulj
Level IV

Using Column Name in Function

Can somebody help me out with the following??

Column1 = char(ColumnName(1));

Column2 = char(ColumnName(2));

Eval(Parse(EvalInsert("\[

obj << simulator(

                    1,

                    Factors(

                    AB << Random( ^distNameOne^( ^strParameterOne^ ) ),

                    ^Column2^ << Random( ^distNameTwo^( ^strParameterTwo^ ) )

                    ),

                    Responses(

                              :Column 3 << No Noise

                    ),

                    Automatic Historam Update(1),

                    Simulate

);

]\")));

If I name the first column "AB" manually, the profiler works fine for it. However attempting to automatically use the column name as in Column2 does not work. Any ideas on how to get it to work?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Using Column Name in Function

You're sending column actions to a string.  Try these two variations:

:^Column2^ << Random( ^distNameTwo^( ^strParameterTwo^ ) )

column(^Column2^) << Random( ^distNameTwo^( ^strParameterTwo^ ) )

or maybe even

as column(^Column2^) << Random( ^distNameTwo^( ^strParameterTwo^ ) )

View solution in original post

6 REPLIES 6
pmroz
Super User

Using Column Name in Function

You're sending column actions to a string.  Try these two variations:

:^Column2^ << Random( ^distNameTwo^( ^strParameterTwo^ ) )

column(^Column2^) << Random( ^distNameTwo^( ^strParameterTwo^ ) )

or maybe even

as column(^Column2^) << Random( ^distNameTwo^( ^strParameterTwo^ ) )

abdulj
Level IV

Re: Using Column Name in Function

Thanks for the quick response.

At first your solution did not seem to work. Then, I decided to manually change the name of the columns to something simpler and that did the trick.

Any ideas why a column named something like "S/B nominal length-c" won't work, but if I renamed it to "SB nominal length c" it does work??

BTW, I used the following format:

:^Column1^ << Random

Or perhaps there's a way to have the script automatically remove any punctuation at the beginning?

Thanks

pmroz
Super User

Using Column Name in Function

That column name won't work because of the forward slash.  This construct should work though:

:name(^Column2^) << Random( ^distNameTwo^( ^strParameterTwo^ ) )

abdulj
Level IV

Using Column Name in Function

I get the following error when I tried that:

Name arg must be quoted string Line 5 Column 9: name(.....

pmroz
Super User

Re: Using Column Name in Function

You probably need quotes around the column name then.

:name("^Column2^") << Random( ^distNameTwo^( ^strParameterTwo^ ) )

abdulj
Level IV

Using Column Name in Function

Great, everything works like a charm. Thanks again!