Subscribe Bookmark RSS Feed

How to embed application, scripts and data tables in a package

samir

Community Trekker

Joined:

May 20, 2016

Hello,

I am writing an application that is supposed to be distributed to users...

For several reasons, I need the application to centralize all the scripts and data tables needed to run (no need to call a script or a reference-datatable outside the application).

I succeeded to centralize all my scripts in functions embedded in the application, but I do not know how to embed the data tables (which means I still need to keep some reference data tables in a public location and call them from the application)...

Someone knows how to embed everything in a single App to be able to disctribute it ?

 

Many thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp

Staff

Joined:

Jun 23, 2011

Solution

I think the 'best' way to do this may depend on how you are building the application (with Application Builder?), and what workflow and user interface you want. Dan's blog post might be useful.

Don't forget that you can also 'include' JMP tables by adding the JSL to generate them to your own code (use 'Copy Table Script' from red triangle menu of the required table).

12 REPLIES
ian_jmp

Staff

Joined:

Jun 23, 2011

Solution

I think the 'best' way to do this may depend on how you are building the application (with Application Builder?), and what workflow and user interface you want. Dan's blog post might be useful.

Don't forget that you can also 'include' JMP tables by adding the JSL to generate them to your own code (use 'Copy Table Script' from red triangle menu of the required table).

samir

Community Trekker

Joined:

May 20, 2016

Jan,

I started using Application Builder but then I stopped (I do not reaaly understand how to control the objects I create...Besides I have limited objects to insert compared to a full scripting method).

Anyway, now I am scripting everything.

The example of Dan is very good to illustrate what I wat to do: In his example, what is called embedding a datatable is just making it appear in the Application builder. But in reality, it is sourced from its location ($SAMPLE_DATA\Big Class.jmp). This means that the code of Dan will not work if I do not have a copy of the data table "Big Class" already stored somewhere on my computer.

What I want to do is embed tables in the Application so that users do not need to have a copy of this table (and by the way, these tables are sort of Specifications or references, so I cannot generate them by script).

I hope my explanation is not to vague...  :(

ian_jmp

Staff

Joined:

Jun 23, 2011

I don't fully understandthe comment about 'specifications or references', but perhaps I don't need to if this thread helps.

samir

Community Trekker

Joined:

May 20, 2016

Hi Jan,

I am sorry, I missunderstood one of your key tips !!!!  :)

In fact your proposal to "Copy Data Script" should be the magic thing to make it work !!!!! I was not aware of this feature !

Let me test it ...

 

Many thanks.

samir

Community Trekker

Joined:

May 20, 2016

Jan,

I joined below a simple code to test your proposal.

I am sure the principle works, but somehow I cannot manage to do it:

dt = CreateTab();

CreateTab = Function( {},
	A = New Table( "TestTable",
	Add Rows( 4 ),
	New Column( "Age",
		Numeric,
		Continuous,
		Format( "Best", 12 ),
		Set Values( [3, 5, 2, 8] )
	),
	New Column( "Height",
		Numeric,
		Continuous,
		Format( "Best", 12 ),
		Set Values( [0.6, 1.03, 0.55, 1.3] )
	)
);
	A;
);

It is like the generated table cannot be passed to dt.

 

ian_jmp

Staff

Joined:

Jun 23, 2011

This worked for me:

NamesDefaultToHere(1);

CreateTab = Function( {}, {Default Local},
	A = New Table( "TestTable",
		Add Rows( 4 ),
		New Column( "Age", Numeric, Continuous, Format( "Best", 12 ), Set Values( [3, 5, 2, 8] ) ),
		New Column( "Height", Numeric, Continuous, Format( "Best", 12 ), Set Values( [0.6, 1.03, 0.55, 1.3] ) )
	);
	A;
);

dt = CreateTab();
dt << Distribution(Y(:Height));

If you call your function twice JMP will take care of the table name collision so it still works.

pmroz

Super User

Joined:

Jun 23, 2011

Ian (not Jan btw) showed code where the function is defined before being called.  Your code calls the function before it is defined.

samir

Community Trekker

Joined:

May 20, 2016

Ahhhh,

I see. It works perfectly now...

I was not awared that you need first to define the function ten call it. In other languages, after compilation, the function is recognized wherever it is placed (even outside the script).

Thanks guys !!

txnelson

Super User

Joined:

Jun 22, 2012

FYI,

JMP is an interpretive language, not a compiled language. 

Jim