cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
andyknc
Level I

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

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

3 REPLIES 3
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 I

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).