Choose Language Hide Translation Bar
Highlighted
jpol
Level IV

How to run a query on mouseover, using data from the underlying datapoint?

Hi,

I would like to run a database query on a mouseover.

In my case I have many millions of images but am only interested in seeing very few of them, one at a time.

I have mocked up a case using data from Big Class &  Big Class Families data sets.

 

Here’s the scenario:

From ’Big Class’ I plot weight versus height.

As a matter of interest I want to see what JAMES looks like.

I have a picture of him in ’Big Class Families’ so I thought that I could take a look by running a query when I mouse over JAMES’s marker on the GB Scatter Plot.

I have attempted to take advantage of the Hover Label / Paste Graphlet functionality. From the script below you can see that the query can easily be performed but unfortunately I have had to hard code "JAMES" into the query.

 

What I need is that the name "JAMES" would be put into a variable on mouseover and later used in the SQL. In that way I could look at the image of any person just by hovering my mouse over the point(s) of interest.

 

Names Default To Here( 1 );
dt = Open( "$Sample_Data/Big Class.jmp" );

Graph Builder(
Variables( X( :height ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Set Graphlet(
Picture(
dt = Open( "$Sample_Data/Big Class Families.jmp" );
//ImageFor = "JAMES";
ImQ = Query(
Table( dt, "t1" ),
"SELECT name, picture From t1 WHERE name = \!"JAMES\!" "
);
)
)}
)
)
);

The final application is for the review of semiconductor wafers, where after making a wafermap based on defect locations, the query would go back to the database and pull the image for the defect(s) of interest. When the number of defects is occasionally quite large it is not practical to load all images into the datatable for reviewing purposes.

 

Thanks,

 

Philip

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to run a query on mouseover, using data from the underlying datapoint?

Hi @jpol,

This is a really cool example, and you got 99% there.

The variable you are looking for is in the local context:

  ImageFor = local:_name;

The graphlet JSL extensions are executed inside a Local block we call Hover Label Execution Context, or HLEC for short. It contains variables with data and metadata (as in, column names) extracted from the graph definition and the underlying visual element. You can find the documentation of the HLEC variables here.

In the code fragment above, I took advantage of the fact that the content of labelled columns is available in the HLEC by name (with a "_" prefix) but you could also have got the contents of any column in the underlying table by using a direct index reference, like so:

  ImageFor = Column(local:_dataTable, "name")[local:_firstRow];

It is important to use the Column() command here to make sure you are getting the value from the table associated with the graph, and not the one you opened to get the image from.

Please see the attached scripts which implement your design, and then evolve it to show the image on the thumbnails and only open the secondary table on click.

You might also want to check these Community discussions which are about similar scenarios:

* https://community.jmp.com/t5/Discussions/Hover-graphlet-from-another-data-table/m-p/296005

* https://community.jmp.com/t5/Discussions/Hover-label/td-p/287358

On the Community File Exchange, Label Viewer and Wiki Reader, are examples of graphlet advanced customizations that show how to display multiple images and external images, respectively.

Last but not least, a shameless plug for my upcoming Discovery Presentation on Graphlets and its underlying "plumbing".

https://community.jmp.com/t5/Discovery-Summit-Americas-2020/From-Details-on-Demand-to-Wandering-Work...

Cheers,

  Nascif

View solution in original post

3 REPLIES 3
Highlighted

Re: How to run a query on mouseover, using data from the underlying datapoint?

Hi @jpol,

This is a really cool example, and you got 99% there.

The variable you are looking for is in the local context:

  ImageFor = local:_name;

The graphlet JSL extensions are executed inside a Local block we call Hover Label Execution Context, or HLEC for short. It contains variables with data and metadata (as in, column names) extracted from the graph definition and the underlying visual element. You can find the documentation of the HLEC variables here.

In the code fragment above, I took advantage of the fact that the content of labelled columns is available in the HLEC by name (with a "_" prefix) but you could also have got the contents of any column in the underlying table by using a direct index reference, like so:

  ImageFor = Column(local:_dataTable, "name")[local:_firstRow];

It is important to use the Column() command here to make sure you are getting the value from the table associated with the graph, and not the one you opened to get the image from.

Please see the attached scripts which implement your design, and then evolve it to show the image on the thumbnails and only open the secondary table on click.

You might also want to check these Community discussions which are about similar scenarios:

* https://community.jmp.com/t5/Discussions/Hover-graphlet-from-another-data-table/m-p/296005

* https://community.jmp.com/t5/Discussions/Hover-label/td-p/287358

On the Community File Exchange, Label Viewer and Wiki Reader, are examples of graphlet advanced customizations that show how to display multiple images and external images, respectively.

Last but not least, a shameless plug for my upcoming Discovery Presentation on Graphlets and its underlying "plumbing".

https://community.jmp.com/t5/Discovery-Summit-Americas-2020/From-Details-on-Demand-to-Wandering-Work...

Cheers,

  Nascif

View solution in original post

Highlighted
jpol
Level IV

Re: How to run a query on mouseover, using data from the underlying datapoint?

Hi Nascif,

 

Thank you for your prompt response and great solution. This is exactly the functionality that I was looking for.

I will try to build an example of the final application and share it with you.

 

Sláinte,

 

Philip

Highlighted

Re: How to run a query on mouseover, using data from the underlying datapoint?

Excellent!
Looking forward to it.
Article Labels