Opening a window on table row selection and passing a parameter to the opening window

In vision, I am trying to open a window with a table row selection and pass a parameter from the row selection to the opening window. I am able to open the window but it doesn't pass the parameter to the tables custom property 'Date'. I have the same custom property 'Date' on the window where I am selecting the row from the table. Any ideas?

table = event.source 
if table.selectedRow>=0: 
    param = table.data.getValueAt(table.selectedRow, "DateOnly") 
    system.nav.openWindow("Maintenance/Burner Off/Dryer 1 Burner Day History 
    {"Date": param})

This is a propertyChange event on the table? Perhaps try rewriting it like this:

if event.propertyName == 'selectedRow' and event.NewValue > -1: 
    param = table.data.getValueAt(event.newValue, "DateOnly") 
    system.nav.openWindow("Maintenance/Burner Off/Dryer 1 Burner Day History", {"Date": param})

Note how this can only happen on one propertyChange event, and that a missing quotation mark on your window path as well as a comma seperating the path and the parameters have been added.

Edit: Removed an inadvertent enter after the widow path

I got it to work, I had to put the custom property on the window and not the new table. I added some print statements, then realized my error.

table = event.source

if table.selectedRow >= 0:
    param = table.data.getValueAt(table.selectedRow, "DateOnly")
    
    # Print statements for debugging
    print("Selected DateOnly:", param)
    
    windowPath = "Maintenance/Burner Off/Dryer 1 Burner Day History"
    parameters = {"Date": param}
    
    # Print statements for debugging
    print("Opening window with parameters:", parameters)
    
    system.nav.openWindow(windowPath, parameters)

I'm glad you got it to work, but please consider the script I offered. The best practice is to limit propertyChange event scripts to specific properties. The initial if statement for any propertyChange event should include the property name, and all scripting logic for that event should occur within that if statement. Otherwise that code will evaluate for every property that changes on the component.

Not just a "best practice". You will have numerous weird bugs if you fail to check event.propertyName for the property you need to monitor.

when I try your example I get a error

Traceback (most recent call last):
  File "<event:mouseClicked>", line 1, in <module>
AttributeError: 'java.awt.event.MouseEvent' object has no attribute 'propertyName'



I see; you are using the mouse clicked event. I use the propertyChange event for this sort of thing, so I had imagined that's what you were using.

got it, changed it to property change script. Thanks for the help.