Report Viewer Component - Select Item

Hi,

I currently have a window that basically has two components. The first is a Tree View that lists all the available reports created, and the second is a Report Viewer that displays the selected report. The reports are fairly simple, basically comprised of one or more Simple Tables where the first column is static text, and the remaining columns are Historical Queries to populate the data. These reports can be a single page, or span multiple pages. I am wondering if there is a way to do the following:

User opens the client, selects the report that they want to view and reviews the data. Something catches their eye, and they want to bring up a trend of the applicable data. The trends are already built, so I would like for them to simply click on the line that is giving them problems, and swap to the applicable trend window.

My first thought was to brute force this, where I script on a mouse Event to pick up the mouse location, determine which row the user clicked on, then swap windows. However the Report Viewer does not seem to pick up the Event if the user clicks inside the Viewer (works fine if they click outside). So then I dropped a Container on top of the viewer, set the Alignment to be on top, and then removed the visible property, but still doesn’t pick up the event. Also tried with a hidden button.

The only other way I can think of accomplishing this is to drop a bunch of buttons beside the viewer, aligned with the applicable rows, and have them select it that way. However, I currently have at least a dozen reports, some multiple pages long, so not only would I need to know which report they were looking at (straight forward), but I would also need to know what page they are on, and update the button visibility / locations appropriately.

There was a previous forum post from 2013 that was similar in nature, but never really got answered (Scripting Report Viewer)

Am I over thinking this? Is there an easier way to accomplish?

Thanks.

Also, does anyone know why a EventHandler->mouse->mouseReleased doesn’t seem to work over a Report Viewer? Is there another script that is overriding mine?

None that I can think of, unfortunately. Reports really aren't designed around being interactive in this way.

Not another script, but what's happening is the actual underlying java object that holds the report viewer isn't really something we "control" (since our component is basically just a wrapper around the reporting library's viewer component). So it has its own mouse interaction and handling, and our code doesn't wrap it properly. It's something we could probably fix, it just hasn't come up to our list before.

I would have a hidden table that mimics the history query.
Put a button to toggle visibility on it for the users.
The user sees something wrong, clicks the Detail button.
The table is shown and report viewer hidden.
Then they can select a row in the table and you could easily use the row data to go after anything.

A not-at-all easy, but more dynamic solution would be something like this:

  1. Add a transparent label over the report viewer to intercept all mouse events.
  2. During a mouse event on that label, drill into the Report Viewer component to get it’s internal RMViewer object (getComponent(<some Index>); print getComponents() on the Ignition component to see its internal structure).
  3. Call getShapeAtPoint on the RMViewer object with your mouse coordinates and do something based on the shape you got.

It’s absolutely not going to be easy, and it’ll take some fairly high level Java/Jython knowledge. Good luck.

@PGriffith That makes so much more sense. I tried to place both a Container and a Button (the same size as the viewer) over the viewer, and set the stack alignment to top then changed the visibility to false and it still wouldn’t pick up. I like the idea of using a transparent label. Thanks, I’ll give that a shot. But if I do that, then the right click for the report viewer would break, I’d have to recreate that correct?

Right - what you could do is check whether event.isPopupTrigger() is true on the mouse event on the label, then send a new mouse event (essentially, a copy of the existing one) to the overlayed report viewer, using dispatchEvent. Once again, higher level knowledge of Swing/Java is implied.