Subscribe Bookmark RSS Feed

accessing helpkey or how do I confirm a report is a certain platform?

hlazar

Occasional Contributor

Joined:

Jan 13, 2017

Can you access the Helpkey value of a report? I want to confirm that a report is a certain platform, say bivariate, and the Helpkey seems to have the information I want if the title is changed. If I can not use the helpkey, is there another way to confirm this? The only way I can figure out is verifying there are 2 continuous axes.

 

 

2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

 
Jim
Craige_Hales

Staff

Joined:

Mar 21, 2013

Maybe a different approach would work.  This script looks through all the open windows to find reports and displays their scripts.  The script tells how to recreate the report and probably also has the information you need.

// get a list of open windows
wlist = Window();
// some of them might be platforms
For( i = 1, i <= N Items( wlist ), i += 1,
    ob = Try( wlist[i][Outline Box( 1 )] );
    // see if there is an outline box
    If( Type( ob ) == "DisplayBox", 
        // the outline box might be a platform owner,
        // see if it is a scriptable object
        platform = ob << getscriptableObject;
        If( Type( platform ) == "Scriptable", 
            // found one.  display its script
            Show( platform << getscript );
            s = platform << getscript;

            If( Head( s ) == Expr( distribution() ),
                If(
                    Head( Arg( s, 1 ) ) ==
                    Expr( ContinuousDistribution ),
                    Print( "ok" );//
                , //
                    Print( "no" );//
                )//
            , //
                Print( "not close" )
            );
        );
    );
);

With several windows open and two reports:

platform << getscript = Bivariate(Y(:weight), X(:height), Fit Line({Line Color({213, 72, 87})}));
"not close"
platform << getscript = Distribution(Continuous Distribution(Column(:weight)), Nominal Distribution(Column(:age)));
"ok"

The script is returned as an expression; you can either use the expression functions to study it or convert it to a string with char() and use character functions to study it.

c = char(NameExpr(s)); // convert to character
"Distribution(Continuous Distribution(Column(:weight)), Nominal Distribution(Column(:age)))"

contains(c,"Nominal Distribution") // find location of text
56

 

Craige