Subscribe Bookmark RSS Feed

Using Column Name in Function

abdulj

Community Trekker

Joined:

Jul 12, 2011

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
Solution

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^ ) )

6 REPLIES
Solution

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

Community Trekker

Joined:

Jul 12, 2011

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

Joined:

Jun 23, 2011

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

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

abdulj

Community Trekker

Joined:

Jul 12, 2011

I get the following error when I tried that:

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

pmroz

Super User

Joined:

Jun 23, 2011

You probably need quotes around the column name then.

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

abdulj

Community Trekker

Joined:

Jul 12, 2011

Great, everything works like a charm. Thanks again!