Issue with Navigating to Edit Form in Ignition – Error: "Received event for missing view 'Components/HomePage@C$0:0'"

I’m encountering an issue with navigating to an Edit form view in Ignition Perspective. I have a table on my homepage that lists person information. When I select a row in the table and click an "Edit Person" button, I expect it to navigate to an Edit form page that loads data for the selected person. However, instead of navigating successfully, I get the following error:

Received event for missing view "Components/HomePage@C$0:0"

The Edit Person button has the following script in its runAction method:

def runAction(self, event):
logger = system.util.getLogger("EditPerson")
try:
# Get selection data
selection_data = self.parent.parent.parent.getChild("Enter-ExitContainer").getChild("ON-OffsiteTable").props.selection.data
logger.info("Selection data: {}".format(selection_data))

    # Extract the selected PersonID
    if selection_data and len(selection_data) > 0:
        person_id = selection_data[0].get("PersonID", None)
        logger.info("Selected PersonID: {}".format(person_id))
        
        if person_id is not None:
            # Navigate with PersonID as parameter
            system.perspective.navigate(page="Views/Components/EditNewPerson", params={"PersonID": person_id})
            logger.info("Navigated to EditNewPerson view with PersonID: {}".format(person_id))
        else:
            logger.warning("No PersonID selected")
            system.perspective.sendMessage("error_message", {"message": "Please select a person to edit.", "color": "red"})
    else:
        logger.warning("No row selected")
        system.perspective.sendMessage("error_message", {"message": "Please select a row to edit.", "color": "red"})
except Exception as e:
    logger.error("Error handling edit button action: {}".format(str(e)))
    system.perspective.sendMessage("error_message", {"message": "An error occurred: {}".format(str(e)), "color": "red"})

Troubleshooting Done:

  1. Confirmed the PersonID is retrieved correctly when a row is selected.
  2. Checked that the view path "Views/Components/EditNewPerson" is correct.
  3. Attempted different navigate methods and formats but still encounter the same error.

Any guidance on resolving the "missing view" error or on correctly navigating to the Edit form would be greatly appreciated!

Hello,

You mentioned you are navigating to a view not a page. Does the view in question have the same url setup? Otherwise maybe change your page argument to view, so instead of page= use view=. Keep in mind using the view= will not change the url in your browser upon navigating.

Regards,

Frank

Hello Frank,

Thank you for your reply!

I’ve updated the navigation as suggested by using view= instead of page=, but I'm still encountering an error: "Received event for missing view 'Components/HomePage@C$0:0'". Here’s a summary of what I've done so far:

  1. Selected a row in the table on the home page (View/Components/HomePage).
  2. Configured the event to navigate to a view (Components/EditNewPerson).
  3. Added a script in the EditPerson button with logic to capture PersonID from the selected row, log the data, and navigate to EditNewPerson view with the PersonID as a parameter.(I add navigate as view (Components/EditNewPerson) and wrote script in the EditPerson button like (> def runAction(self, event):
"""
Handle the edit button action to fetch person data and navigate to the EditNewPerson page.
"""
logger = system.util.getLogger("EditPerson")

try:
    # Get the selection data from the table in HomePage
    selection_data = self.parent.parent.parent.getChild("Enter-ExitContainer").getChild("ON-OffsiteTable").props.selection.data
    logger.info("Selection data: {}".format(selection_data))
    
    # Get the selected PersonID
    if selection_data and len(selection_data) > 0:
        person_id = selection_data[0].get("PersonID", None)
        logger.info("Selected PersonID: {}".format(person_id))
        
        if person_id is not None:
            # Prepare the parameters to pass to EditNewPerson
            params = {"PersonID": person_id}
            logger.info("Navigating to EditNewPerson with PersonID: {}".format(params))
            
            # Navigate to EditNewPerson view with PersonID as a parameter
            system.perspective.navigate(view="Views/Components/EditNewPerson", params={"PersonID": person_id})
            #system.perspective.navigate("/Components/EditNewPerson", params=params)

except Exception as e:
    logger.error("Error handling edit button action: {}".format(str(e)))
    system.perspective.print("An error occurred: {}".format(str(e))))) 
  1. In EditNewPerson, I’ve created PersonID as a custom property, along with a script to fetch and display related data based on PersonID. (> def valueChanged(self, previousValue, currentValue, origin, missedEvents):
logger = system.util.getLogger("EditPerson")
# Retrieve PersonID from self.custom properties
person_id = self.custom.PersonID

params = {"PersonID": person_id}
result = system.db.runNamedQuery("CETSecurity", "SelectPerson", params)
logger.info("EditPersonID: {}".format(params))
        
        # Convert the dataset to a Python dataset
pyData = system.dataset.toPyDataSet(result)
logger.info("EditPersonID: {}".format(pyData))
if len(pyData) > 0:
        row = pyData[0]  # Get the first row
        print("Data found for PersonID")

            # Assigning each value to self.custom properties

        self.custom.FirstName = row["FirstName"]
        self.custom.LastName = row["LastName"]
        self.custom.Company = row["CompanyName"]
        self.custom.Department = row["DepartmentName"]
        self.custom.Role = row["Role"]
        self.custom.Reason = row["Reason"]
        self.custom.DLNumber = row["DriverLicenseNumber"] 
        self.custom.DLState = row["DLState"]
        self.custom.VehicleMake = row["VehicleMake"]
        self.custom.VehicleModel = row["VehicleModel"]
        self.custom.VehicleColor = row["VehicleColor"]
        self.custom.VehicleLicensePlate = row["LicensePlate"]
        self.custom.TWICNumber = row["TWICNumber"]
        self.custom.ExpirMonth = row["ExpirationMonth"]
        self.custom.ExpirDay = row["ExpirationDay"]
        self.custom.ExpirYear = row["ExpirationYear"]
        
           

        print("Custom properties updated with retrieved data")

else:
       print("No data found for PersonID:", person_id)) 

However, data isn’t showing on the edit form as expected, though logs indicate the selected row and PersonID details are being captured.

Any additional thoughts on resolving this view navigation or data-fetching issue would be much appreciated!

Best regards,
Zarrin