ignitionscada-ignition

Ignition 7.8 – Get Component Text From Text Area Within Container Via Scripting


A Button with scripting is saving Component values to parameters for a SQL update. The calling button is one level above the Container that holds the Text Area. However, the set for the Text Area value using the recommended User Manual method is throwing the error “AttributeError: 'NoneType' object has no attribute 'text'

Standard form not working:

Comments = event.source.parent.getComponent('textArea1).text

Also tried different attributes at the end of the call:

… .string , … .value , … .stringvalue
event.source.parent.parent.getComponent('textArea1).text

When looking at the Property Binding path on the Component, I am able to return “Root Container. ContainerName.textArea1.text”. When I modified to be a GetProperty pull like below, I received a similar error mixed with an add on of Selected Property Not Found. I tried similar alternatives to those listed above.

Comments = event.source.parent.ContainerName.getComponent('textArea1).text

Any suggestions?


Solution

  • The solution is to call the Container component by name using the ‘.getComponent’ method and then call the Text Area using the standard method. The combined code is below for setting to the Parameter Comments.

    Comments = event.source.parent.parent.getComponent('ContainerName').getComponent('TextArea1').text
    

    Retrieving a Component value from within a Container does not appear to be covered in the Ignition Manual.