Subscribe Bookmark RSS Feed

How do I get platform preferences as a variable?

mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

Hi, I would like to use the function "get platform preferences(distribution(count axis))" or something similar, and store the result of this in a boolean or integer, but I'm not sure how to do it.  I'm on JMP11 / 12.

I have a script that generates reference lines on the distribution platform plot output. Note that this is not adding reference lines to the axis property of a column, which stays with the table. These are lines that get added to the plot output only, and disappear when the report window is closed. To do this, i need to modify the axisbox(n) property of the report.  For my preferences (count axis = 0, density axis = 0, prob axis = 0), n = 1.  But if any of those axes are enabled, n increases to 2, 3 or 4. I would like to detect these user settings and modify n accordingly.

Here's what I figured I would do (and some minor variations of this), but these pref variables don't contain strings or integers. I'm not sure how to access them, other than seeing values in the log. Any ideas? My work around would be to just turn off these 3 axes for my script regardless of user settings, but I figured this was worth a shot first.

pref1 = get platform preference(Distribution(count axis));

show(pref1);

pref2 = get platform preferences(distribution(prob axis));

show(pref2);

pref3 = get platform preferences(distribution(density axis));

show(pref3);

n=1;

if(contains(char(pref1), "(1)"),n++);

if(contains(pref2, "(1)"),n++);

if(contains(pref3, "(1)"),n++);

//edit, i forgot about stack...

pref4 = get platform preferences(distribution(stack));

if(pref4 == 0, n = 1);

//end edit

then just modify axis box (n)

BTW, log shows:

pref1 = Platform Preferences(Distribution(Count Axis(0)));

pref2 = Platform Preferences(distribution(Prob Axis(0)));

pref3 = Platform Preferences(distribution(Density Axis(0)));

along with an error on the contains(pref2) because the string comparison didn't work as i hoped. char(pref1) didn't work either. it becomes "."

Thanks,

Mike

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

The preferences are returned as expressions. Work with them as such or convert them to strings. The latter may require NameExpr() to prevent the expressions from evaluating. Either of the below approaches should work:

if(arg(arg(arg(pref1,1),1),1),n++)

if(contains(char(nameexpr(pref1)), "(1)"),n++);


4 REPLIES
Solution

The preferences are returned as expressions. Work with them as such or convert them to strings. The latter may require NameExpr() to prevent the expressions from evaluating. Either of the below approaches should work:

if(arg(arg(arg(pref1,1),1),1),n++)

if(contains(char(nameexpr(pref1)), "(1)"),n++);


mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

Thanks, I didn't know (or maybe remember) about the nameexpr() and I figured there would be some way to extract it but didn't really understand how to do it. i.e. arg function.

I showed your solution to my wife and she summed it up aptly:  Arg! Arg! Arg!

Thanks again,

Mike

Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

You're married to a pirate?

-Jeff

-Jeff
mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

Aye, I suppose I am.