cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

How to add a dynamically-created dashboard to the Scripts panel of a data table?

andyknc
Level II

Hi All,

 

I have a JSL script that lets the user choose one or more data files and then concatenates these files together into a data table. The script then creates a dashboard for the data table.

 

To generate the JSL for the dashboard, I first manually created a dashboard (File -> New -> New Dashboard), adding manually-generated graphs to it in the Dashboard Builder; I then copied the dashboard code from the Dashboard Builder (red arrow -> Save Script -> To Script Window) and pasted it at the end of my JSL script. 

 

This all works great -- however, my goal is to save the generated dashboard to the Scripts panel of the data table, in the same way that choosing red arrow -> Save Script -> To Data Table from the Dashboard Builder will save a dashboard to the data table. I'd also prefer to not have the dashboard appear automatically (the user should click it in the Scripts panel when they want to see it).

 

I've tried searching the JSL reference PDF and the community discussions, but haven't found what I need. Can anyone point me in the right direction? Sanitized code is attached, omitting the data table generation.

 

Thanks!

 

Andy

1 ACCEPTED SOLUTION

Accepted Solutions


Re: How to add a dynamically-created dashboard to the Scripts panel of a data table?

You can try something like this:

dashboardExpr = Expr(
	/* Code for JMP App goes here */
);

Eval(Substitute(
	Expr(Current Data Table() << New Script("Dashboard",dbExpr)),
	Expr(dbExpr),Name Expr(dashboardExpr)
));

Change Current Data Table() to the reference table to which you're adding the Dashboard. There might be other variables that need to be initialize before the Dashboard runs. The variable title on line 17 was causing problems as was the non-existant blob around line 24 (although I can understand why that wasn't included if you chose to leave it out).

 

 

View solution in original post

5 REPLIES 5
jthi
Super User


Re: How to add a dynamically-created dashboard to the Scripts panel of a data table?

I don't use application builder and I would build the script in a different way. but maybe @DonMcCormack has some ideas? This might have some ideas what you could do  Why Aren't You Using App Builder Already? - (2023-US-30MP-1401) (on same topicScripters Club 2024: Session 1 - Application Builder)

 

-Jarmo


Re: How to add a dynamically-created dashboard to the Scripts panel of a data table?

You can try something like this:

dashboardExpr = Expr(
	/* Code for JMP App goes here */
);

Eval(Substitute(
	Expr(Current Data Table() << New Script("Dashboard",dbExpr)),
	Expr(dbExpr),Name Expr(dashboardExpr)
));

Change Current Data Table() to the reference table to which you're adding the Dashboard. There might be other variables that need to be initialize before the Dashboard runs. The variable title on line 17 was causing problems as was the non-existant blob around line 24 (although I can understand why that wasn't included if you chose to leave it out).

 

 

andyknc
Level II


Re: How to add a dynamically-created dashboard to the Scripts panel of a data table?

Thanks Don! This works perfectly (and you are right about 'title' and the blob).

Greenhorn
Level III


Re: How to add a dynamically-created dashboard to the Scripts panel of a data table?

@DonMcCormack 

 

Hi Don,

I use your solution now.

However, do you know why it is not possible to solve with Eval und Expr?
I believed that I just started to understand Eval and Eval Expr but it didn't work with"New Script"

jthi
Super User


Re: How to add a dynamically-created dashboard to the Scripts panel of a data table?

How did you use it?

 

Edit:

Hopefully this gives some ideas (I would assume it would work in similar way with dashboard expression)

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");
dt << Delete Scripts(dt << Get Table Script Names);


gb_expr = Expr(Graph Builder(
	Variables(X(:weight), Y(:height), Overlay(:sex)),
	Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
));

Eval(Substitute(
	Expr(dt << New Script("GB1", myexpr)),
	Expr(myexpr), Name Expr(gb_expr)
));

Eval(EvalExpr(
	dt << New Script("GB2", Expr(Name Expr(gb_expr)));
));
-Jarmo