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
hogi
Level XII

List of all Platform objects?

If I generate a platform via JSL with a By variable, the return value is a list of all generated scriptable objects.

If I use the platform command just to open the Dialog - and then later, after the user clicked on OK, what is a fast & robust way to get the list of all scriptable objects which were generated?

 

Something like

(current report() << xpath("//OutlineBox")) << get scriptable object()

... with a clever preselection:  just OutlneBoxes that make sense
best: a universal preselection which doesn't have to be adjusted for the individual case.

 

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

New Window("test",V List Box(
dist1=Distribution (by( :age ))), // return value: list of the scriptable objects
dist2 = Distribution(
	Continuous Distribution(Column( :height )),
	By( :age )
));

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
hogi
Level XII

Re: List of all Platform objects?

Remove Local Data Filters (with Class Name : Data Filter[] - and not "OutlineBox"

collectedOutlineBoxObjects = (Current Report() << xpath( "//OutlineBox[@helpKey and not(ancestor::OutlineBox[@helpKey])]" )) << get scriptable object() ;
ListOfPlatFormObjects={};
For Each({item},collectedOutlineBoxObjects, If(item << class name =="OutlineBox", Insert Into(ListOfPlatFormObjects, item)));

 

View solution in original post

jthi
Super User

Re: List of all Platform objects?

You are most likely able to just use pure XPath as Data filters do have specific value as helpKey (at least based on my very quick check)

//OutlineBox[@helpKey and not(@helpKey = 'Data Filter') and not(ancestor::OutlineBox[@helpKey])]

you can maybe have just one not

//OutlineBox[@helpKey and not(ancestor::OutlineBox[@helpKey] or @helpKey = 'Data Filter')]
-Jarmo

View solution in original post

10 REPLIES 10
jthi
Super User

Re: List of all Platform objects?

I think testing out different platforms and trying to determine robust XPath would be one option.

-Jarmo
hogi
Level XII

Re: List of all Platform objects?

working on it

I hoped that somebody did this already 5 years ago and can directly provide the solution ...

hogi
Level XII

Re: List of all Platform objects?

Is there a "drop duplicates" for Lists of Display Boxes?

The standard approach via

associative array () << get keys

doesn't seem to work.

jthi
Super User

Re: List of all Platform objects?

If fairly sure you won't really have duplicates if you get all the outline boxes as they do refer to different objects.

If you take a look at few different platforms created using By variable, you will most likely see common things

Distribution:

jthi_0-1697297430022.png

Oneway:

jthi_1-1697297463285.png

Graph Builder (a bit more rare to be created using By variable):

jthi_2-1697297513060.png

You have HeadBox, ListBox and OutlineBox (in Graph Builder I think the correct display box is OwnerBox) and they have specific order. Also OutlineBox/OwnerBox have helpKey attribute.

-Jarmo
hogi
Level XII

Re: List of all Platform objects?

So:

(current report() <<  xpath("//OutlineBox[@helpKey]"))
jthi
Super User

Re: List of all Platform objects?

I would guess that using that XPath will at least sometimes get you too many references. What I would try is to access the first level of OutlineBox which has helpKey attribute which is inside ListBox. Not sure if this will work in each of the JMP's platforms but this is hopefully a starting point

obs = (current report() << xpath("//ListBox//OutlineBox[@helpKey and not(ancestor::OutlineBox[@helpKey])]")) << get scriptable object();

 

-Jarmo
hogi
Level XII

Re: List of all Platform objects?

thanks, it works

But unfortunately, it's quite slow.

 

So perhaps it's better to get all items and then ask for the parent and for the helpKey *).

 

*) not working yet ...

 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

New Window( "test",
	Outline Box( "main", Life Distribution( Perspective( Compare Groups ), Y( :weight ), Grouping( :sex ), By( :age ) ) )

);

t0 = HP Time();
list1 = Current Report() << xpath( "//OutlineBox[@helpKey]" );
Show( (HP Time() - t0) / 1000000 );

t0 = HP Time();
list2 = Current Report() << xpath( "//ListBox//OutlineBox[@helpKey and not(ancestor::OutlineBox[@helpKey])]" );
Show( (HP Time() - t0) / 1000000 );

t0 = HP Time();
firstResults = Current Report() << xpath( "//OutlineBox[@helpKey]" );
list3 = {};
For Each( {item, idx}, firstResults[{1, 2}],
	found = Regex( (item << parent) << get xml(), "\A.*helpKey" ); //unfortunately not restricted to first line like should be !??!?!
	If( Is Empty( item << parent ) | Is Missing( found ),
		Insert Into( list3, item )
	);
);
Show( (HP Time() - t0) / 1000000 );

 

 

(HP Time() - t0) / 1000000 = 0.048218; // no restriction
(HP Time() - t0) / 1000000 = 7.204071; // Xpath all-in-one
(HP Time() - t0) / 1000000 = 0.152291; // manual post-selection

jthi
Super User

Re: List of all Platform objects?

You can most likely optimize the second XPath. Few suggestions

//ListBox/*/OutlineBox[@helpKey and not(ancestor::OutlineBox[@helpKey])]

or

//OutlineBox[@helpKey and not(ancestor::OutlineBox[@helpKey])]
-Jarmo
hogi
Level XII

Re: List of all Platform objects?

Remove Local Data Filters (with Class Name : Data Filter[] - and not "OutlineBox"

collectedOutlineBoxObjects = (Current Report() << xpath( "//OutlineBox[@helpKey and not(ancestor::OutlineBox[@helpKey])]" )) << get scriptable object() ;
ListOfPlatFormObjects={};
For Each({item},collectedOutlineBoxObjects, If(item << class name =="OutlineBox", Insert Into(ListOfPlatFormObjects, item)));