cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
FN
FN
Level VI

Virtual linking two tables via JSL scripting

I have one a table opened by the user.

 

After some python code I generate another table that ends:

  • having a subset of columns (keeping same column names)
  • sharing its time index (few rows might have been removed).

How can link these two tables via JSL?

 

The functionality I am after is to have something equivalent as if I did a subset in JMP.

 
// Start of script;
Names Default To Here( 1 );
Clear Log();

dt = Open( "$SAMPLE_DATA/Bands Data.JMP" );

dt  << Subset(
	Linked,
	Suppress formula evaluation( 0 ),
	Sampling Rate( 0.9 ),
	columns( :timestamp, :proof cut, :viscosity, :caliper, :ink temperature )
)

 

 

 

 

9 REPLIES 9
Craige_Hales
Super User

Re: Virtual linking two tables via JSL scripting

The scripting index has three examples under Virtual Join.

Virtual Join in the Scripting Intex. Notice the Example 1 button is a pull down menu with other examples.Virtual Join in the Scripting Intex. Notice the Example 1 button is a pull down menu with other examples.

There's an example of virtual join in Reverse Geocode Lat-Lon to Zip . It saves the tables to disk before using

	zipcodeNS:dtdbf:shape << Set Property( "Link ID", 1 );
	zipcodeNS:dtshp:shape << Set Property( "Link Reference", Reference Table( zipcodeNS:dtdbf ) );

to link them by the shape property.

 

Craige
FN
FN
Level VI

Re: Virtual linking two tables via JSL scripting

Does virtual join create the interactive linking when selecting rows or columns?

 

In the examples I ran this did not happen.

Craige_Hales
Super User

Re: Virtual linking two tables via JSL scripting

No, the tables are not linked like a "linked subset". (edit: see @bernd_heinen answer) But they are linked like a join; if you run that first example and change a color name in the table of colors, the change is immediately reflected in the table of people. @chungwei 

Craige
Craige_Hales
Super User

Re: Virtual linking two tables via JSL scripting

It is also possible I'm not answering the question you really asked. Perhaps an expert on the Tables menu will take another look.

Craige
bernd_heinen
Level V

Re: Virtual linking two tables via JSL scripting

I understand that the subsetting is just an example. If tables are virtually joined row states can be syncronized between them. In the "parent" table there is the column with the linke reference (the blue keys). When you open that column's properties and look for the "link reference" property, you'll find options there.

LinkRef.PNG

Here, you can determine which table shall be driving the row states. All settings can be set by JSL like

Column( "Unique Subject Identifier" ) << Set Property(
	"Link Reference",
	{Reference Table( "Nic Demographics.jmp" ), Options(
		"Use Linked Column Name"(1),
		Row States Synchronization with Referenced Table( Accept( 1 ), Row States( Select, Exclude, Hide ) )
	)}
)

The one thing, that is not possible, is to transfer selections, no matter if they are made in the parent or the child table.

Craige_Hales
Super User

Re: Virtual linking two tables via JSL scripting

Cool! had not seen that before.

Craige
hogi
Level XII

Re: Virtual linking two tables via JSL scripting

Why are options like 

Options(
		"Use Linked Column Name"(1),
		Row States Synchronization with Referenced Table( Accept( 1 ), Row States( Select, Exclude, Hide ) )
	)

not grabbed by the advanced log?

Re: Virtual linking two tables via JSL scripting

This may or may not be an issue.  I will report this to development, about the action recording to see if we can record that in the log.  Thanks for bringing it to our attention.

hogi
Level XII

Re: Virtual linking two tables via JSL scripting

I want to use Virtual Links between Tables in a Dashboard along the idea:

  • use One Data Filter for Table 1
  • Plots/Tabulates for Table 2-N are updated accordingly.

With 

Column( "Unique Subject Identifier" ) << Set Property(
	"Link Reference",
	{Reference Table( "Nic Demographics.jmp" ), Options(
		"Use Linked Column Name"(1),
		Row States Synchronization with Referenced Table( Accept( 1 ), Row States( Select, Exclude, Hide ) )
	)}
)

from https://community.jmp.com/t5/Discussions/Virtual-linking-two-tables-via-JSL-scripting/m-p/305159/hig... 

I can synchronize the row states.

 

Do I need to use a non-local data filter to make it work?

There is no option in the Application Builder to use a non-local data filter, but I can modify the script and remove the local.

Is this a good idea?

 

Better use a Filter State Handler to remote control the data filters of the other tables?