Subscribe Bookmark RSS Feed

JMP 12 will not save Report. Expects scriptable Object error code.

ciao_

New Contributor

Joined:

Jul 5, 2016

Hello all,

I am a new JMP user and I was taking a crack at jsl when I came across an issue.

Purpose: 1) Open a file

                2) Perform Life Distribution

                3) Click the appropriate button for the Format the user would like to export the Distribution Report as.

Issue: I'm unable to get JMP to save the report generated below by the Life distribution.

The concept behind this practice exercise was simple, but I do not see why the last feature isn't working or how to resolve it.

Occasionally I will get the error: Send Expects Scriptable Object in access or evaluation of 'Send'....

==========================================================================

//Algorithm: 1. Open an appropriate data file specified by the user..

// 2. Import the file as a JMP data table.

// 3. Perform the Life Distribution on the given data table.

// 4. Allow user to manipulate the file if needed.

// 5. Once needed changes have been made provide user the option to save report as desired file type

// User will choose the file that they would like to open

dt1 = Open();

// The built in Life Distribution platform is performed on the chosen data table

LD = Life Distribution(

      dt1,

      Y( 1 ), //Time Column

      Censor( 6 ),  // Cumulative Hazard Column

      Censor Code( 1 ),

      <<Fit Weibull,

      Confidence Interval Method( Wald ),

      <<Set Scale( Nonparametric ),

      Interval Type( Simultaneous ),

      Show Event Plot Frequency Label( 0 ),

      <<Set Scriptables(

           {Probability Paper( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

           Weibull Distribution( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

           Weibull Quantile( Profiler( 1, Confidence Intervals( 1 ), Term Value( Probability( 0.5, Lock( 0 ), Show( 1 ) ) ) ) ),

           Weibull Hazard( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

           Weibull Density( Profiler( 1, Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ), Custom Estimation( Weibull, 0 )}

      ),

      Dispatch( {"Compare Distributions"}, "Life Distribution", FrameBox, {Grid Line Order( 2 ), Reference Line Order( 3 )} ),

      Dispatch( {"Statistics", "Model Comparisons"}, "", TableBox, {Sort By Column( 2, 1 )} )

);

     LD << On Close(

          w1 = New Window( "Report Export",

               Text Box("Would you like to export this report in another format? \!n (Note: There are limitations to the types of file formats \!n this report can be exported. ) \!n"),

               Button Box( "Yes",

                    w2 = New Window( "Export Report",

                         Button Box( "Word", LD << save MSword("$DESKTOP\my_file.doc")),

                         Button Box( "Power Point", LD << save Presentation("$DESKTOP\my_file.pptx")),

                         Button Box( "Close", << Close Window())

),

              Show(w2);

              w1 << Close Window();

),

               Button Box( "No",

                    w1 << Close Window()

),

     );

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Below are two versions of your script.  The first one works as you designed it, while the second one is the way I prefer to do these kinds of things, by embedding the save requests right in the Life Distribution output.

//Algorithm: 1. Open an appropriate data file specified by the user..

// 2. Import the file as a JMP data table.

// 3. Perform the Life Distribution on the given data table.

// 4. Allow user to manipulate the file if needed.

// 5. Once needed changes have been made provide user the option to save report as desired file type

// User will choose the file that they would like to open

dt1 = Open();

// The built in Life Distribution platform is performed on the chosen data table

LD = dt1 << Life Distribution(

       Y( Column( 1 ) ), //Time Column

       Censor( Column( 6 ) ),  // Cumulative Hazard Column

       Censor Code( 1 ),

       <<Fit Weibull,

       Confidence Interval Method( Wald ),

       <<Set Scale( Nonparametric ),

       Interval Type( Simultaneous ),

       Show Event Plot Frequency Label( 0 ),

       <<Set Scriptables(

              {Probability Paper( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Distribution( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Quantile( Profiler( 1, Confidence Intervals( 1 ), Term Value( Probability( 0.5, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Hazard( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Density( Profiler( 1, Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ), Custom Estimation( Weibull, 0 )}

       ),

       Dispatch( {"Compare Distributions"}, "Life Distribution", FrameBox, {Grid Line Order( 2 ), Reference Line Order( 3 )} ),

       Dispatch( {"Statistics", "Model Comparisons"}, "", TableBox, {Sort By Column( 2, 1 )} )

);

LD << On Close(

       w1 = New Window( "Report Export",

              Text Box(

                     "Would you like to export this report in another format? \!n (Note: There are limitations to the types of file formats \!n this report can be exported. ) \!n"

              ),

              Button Box( "Yes",w1 << Close Window();

                     w2 = New Window( "Export Report",

                           Button Box( "Word", report(LD) << save MSword( "$DESKTOP\my_file.doc" ) ),

                           Button Box( "Power Point", report(LD) << save Presentation( "$DESKTOP\my_file.pptx" ) ),

                           Button Box( "Close", <<Close Window() )

                     )

              ),

              Button Box( "No", w1 << Close Window() ),

       )

);



Second script:


//Algorithm: 1. Open an appropriate data file specified by the user..

// 2. Import the file as a JMP data table.

// 3. Perform the Life Distribution on the given data table.

// 4. Allow user to manipulate the file if needed.

// 5. Once needed changes have been made provide user the option to save report as desired file type

// User will choose the file that they would like to open

dt1 = Open();

// The built in Life Distribution platform is performed on the chosen data table

LD = dt1 << Life Distribution(

       Y( Column( 1 ) ), //Time Column

       Censor( Column( 6 ) ),  // Cumulative Hazard Column

       Censor Code( 1 ),

       <<Fit Weibull,

       Confidence Interval Method( Wald ),

       <<Set Scale( Nonparametric ),

       Interval Type( Simultaneous ),

       Show Event Plot Frequency Label( 0 ),

       <<Set Scriptables(

              {Probability Paper( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Distribution( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Quantile( Profiler( 1, Confidence Intervals( 1 ), Term Value( Probability( 0.5, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Hazard( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Density( Profiler( 1, Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ), Custom Estimation( Weibull, 0 )}

       ),

       Dispatch( {"Compare Distributions"}, "Life Distribution", FrameBox, {Grid Line Order( 2 ), Reference Line Order( 3 )} ),

       Dispatch( {"Statistics", "Model Comparisons"}, "", TableBox, {Sort By Column( 2, 1 )} )

);

                     w2 = V List Box(

                           Button Box( "Save to Word", report(LD) << save MSword( "$DESKTOP\my_file.doc" ) ),

                           Button Box( "Save to Power Point", report(LD) << save Presentation( "$DESKTOP\my_file.pptx" ) ),

                           Button Box( "Close", LD <<Close Window() )

                     );

                    

Report(ld)["Life Distribution"]<<prepend(w2);

             

Jim
6 REPLIES
Solution

Below are two versions of your script.  The first one works as you designed it, while the second one is the way I prefer to do these kinds of things, by embedding the save requests right in the Life Distribution output.

//Algorithm: 1. Open an appropriate data file specified by the user..

// 2. Import the file as a JMP data table.

// 3. Perform the Life Distribution on the given data table.

// 4. Allow user to manipulate the file if needed.

// 5. Once needed changes have been made provide user the option to save report as desired file type

// User will choose the file that they would like to open

dt1 = Open();

// The built in Life Distribution platform is performed on the chosen data table

LD = dt1 << Life Distribution(

       Y( Column( 1 ) ), //Time Column

       Censor( Column( 6 ) ),  // Cumulative Hazard Column

       Censor Code( 1 ),

       <<Fit Weibull,

       Confidence Interval Method( Wald ),

       <<Set Scale( Nonparametric ),

       Interval Type( Simultaneous ),

       Show Event Plot Frequency Label( 0 ),

       <<Set Scriptables(

              {Probability Paper( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Distribution( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Quantile( Profiler( 1, Confidence Intervals( 1 ), Term Value( Probability( 0.5, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Hazard( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Density( Profiler( 1, Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ), Custom Estimation( Weibull, 0 )}

       ),

       Dispatch( {"Compare Distributions"}, "Life Distribution", FrameBox, {Grid Line Order( 2 ), Reference Line Order( 3 )} ),

       Dispatch( {"Statistics", "Model Comparisons"}, "", TableBox, {Sort By Column( 2, 1 )} )

);

LD << On Close(

       w1 = New Window( "Report Export",

              Text Box(

                     "Would you like to export this report in another format? \!n (Note: There are limitations to the types of file formats \!n this report can be exported. ) \!n"

              ),

              Button Box( "Yes",w1 << Close Window();

                     w2 = New Window( "Export Report",

                           Button Box( "Word", report(LD) << save MSword( "$DESKTOP\my_file.doc" ) ),

                           Button Box( "Power Point", report(LD) << save Presentation( "$DESKTOP\my_file.pptx" ) ),

                           Button Box( "Close", <<Close Window() )

                     )

              ),

              Button Box( "No", w1 << Close Window() ),

       )

);



Second script:


//Algorithm: 1. Open an appropriate data file specified by the user..

// 2. Import the file as a JMP data table.

// 3. Perform the Life Distribution on the given data table.

// 4. Allow user to manipulate the file if needed.

// 5. Once needed changes have been made provide user the option to save report as desired file type

// User will choose the file that they would like to open

dt1 = Open();

// The built in Life Distribution platform is performed on the chosen data table

LD = dt1 << Life Distribution(

       Y( Column( 1 ) ), //Time Column

       Censor( Column( 6 ) ),  // Cumulative Hazard Column

       Censor Code( 1 ),

       <<Fit Weibull,

       Confidence Interval Method( Wald ),

       <<Set Scale( Nonparametric ),

       Interval Type( Simultaneous ),

       Show Event Plot Frequency Label( 0 ),

       <<Set Scriptables(

              {Probability Paper( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Distribution( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Quantile( Profiler( 1, Confidence Intervals( 1 ), Term Value( Probability( 0.5, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Hazard( Profiler( 1, Confidence Intervals( 1 ), Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ),

              Weibull Density( Profiler( 1, Term Value( Column 1( 80.85, Lock( 0 ), Show( 1 ) ) ) ) ), Custom Estimation( Weibull, 0 )}

       ),

       Dispatch( {"Compare Distributions"}, "Life Distribution", FrameBox, {Grid Line Order( 2 ), Reference Line Order( 3 )} ),

       Dispatch( {"Statistics", "Model Comparisons"}, "", TableBox, {Sort By Column( 2, 1 )} )

);

                     w2 = V List Box(

                           Button Box( "Save to Word", report(LD) << save MSword( "$DESKTOP\my_file.doc" ) ),

                           Button Box( "Save to Power Point", report(LD) << save Presentation( "$DESKTOP\my_file.pptx" ) ),

                           Button Box( "Close", LD <<Close Window() )

                     );

                    

Report(ld)["Life Distribution"]<<prepend(w2);

             

Jim
ciao_

New Contributor

Joined:

Jul 5, 2016

Thank you so much! it worked perfectly!

I wasn't sure if JMP would allow implementation of Data Filters on it's life distribution platform. I'm currently looking for scripting option, but I haven't had any luck. Could you possibly point me in the right direction?

Data Filters: The Data Filter

I'm currently looking through the Scripting Guide: Scripting Guide

in tandem with the Syntax reference guide: JSL Syntax Reference

txnelson

Super User

Joined:

Jun 22, 2012

A Data Filter is applied to the data table, not to the platform.  What has to happen in the Life Distribution Platform, is that you need to turn the Automatic Recalc option on, so that when the platform detects a change in the data table(i.e. you changed something in the data filter), it will recalculate the platform display.

11993_pastedImage_0.png

Once you have defined your Data Filter, you can request for it to give you the script that will recreate it.

11994_pastedImage_1.png

Now, you can also choose to use a Local Data Filter.

11995_pastedImage_2.png

In that case, when you request for the platform to generate the script that will reproduce the Life Distribution you have setup, it will include the code for the local data filter

11996_pastedImage_3.png

Jim
ciao_

New Contributor

Joined:

Jul 5, 2016

Two things happen when I attempt that.

(1) The Panel Box disappears

(2) The data filter doesn't make any visible changes to the plot.

12017_GroupFail1.JPG

(Image 1)

12018_GroupFail2.JPG

(Image 2)

In image one there isn't a data filter applied. When the data filter is applied(Image 2) the Save as options disappear. I was attempting to use the data filter to single out a specific model or group of models to display when selected. Are there any options that can provide me with more control using JMP 12? I understand that the version(JMP 12.2) I have may be limited.

Thank you for all of your help so far!

txnelson

Super User

Joined:

Jun 22, 2012

Because you are generating your own output window, with your own specifications within the window, you will have to take over all of the control for the window and detect when you are changing something in the data filter.  So what that means is that you will need to add to your code,

    rs =  dt<<make row state handler(f)

and to add a function "f" that recreates the components within your display window when it detects the change.

I typically set up a template within my display windows, that contain V List Boxes and H List Boxes that I append/delete components from.  So that when a row state change is detected, I delete the necessary items from the display window, recreate them behind the scenes, and the append them back into the display window.

Jim
ciao_

New Contributor

Joined:

Jul 5, 2016

Great! It works. Thank you Jim.

The last thing I would like to do with this data filter is to select the first 10 models via script.

Example 1: In this example the data filter will select and include data related to the model id's specified.

dt1 << Data Filter(

Location( {1000, 50} ),

Mode( Show( 1 ), Include( 1 ) ),

columns( :Item ),

Where( :Item == {"Model ID 1", "Model ID 2", "Model ID 3", "Model ID (n)"} ),

Display( :Item, Size( 204, 140 ), List Display )

);

//I would like to do something similar to this but without having to specify the exact model ID's. I would like to say include the data of the first (n) model ID's.

Example 2: One of my many experimental attempts.

Models = Char(Current Data Table()<< select where(eval(Item[]<3))); //Select first three unique Model Id's and plot them

dt1 << Data Filter(

Location( {1000, 50} ),

Mode( Show( 1 ), Include( 1 ) ),

columns( :Item ),

Where( :Item == Models ),

Display( :Item, Size( 204, 140 ), List Display )

);

Please let me know it you have any suggestions.