Data360 Analyze

 View Only
  • 1.  Using Composite Properties to Parameterize a Node

    Employee
    Posted 03-29-2018 05:43

    When creating custom nodes that are based on the Transform node, you may want to parameterize your node so that values can be configured from an input property of the node rather than editing the underlying Python code used by the Transform node.


    Here is an example that defines a number of properties on a Composite node that are then used by the child Transform node and its Python code. In this case default values are defined for the properties. Alternatively, if you did not want to define a default value for a property, the code could be modified to not specify a default and the node will generate an error. See the Node API documentation for further details.


    The example shows how you can obtain an integer value from a property, obtain a string value and provide the user with a choice of (string) values. The node outputs the value of these properties (or their defaults). If a selection is made for the Choice property, the node also outputs the value of the selected field in a new output field.

    Attached files

    Composite_Node_Property_Example - 29 Mar 2018.lna



  • 2.  RE: Using Composite Properties to Parameterize a Node

    Employee
    Posted 11-28-2019 09:28

    Hi Adrian,

     

    I am trying to replicate this, I have cut and paste the code into my graph. However, I am getting 1/Not Defined/No Selection.

     

    When creating the parameters is there something other than creating them that I need to do?



  • 3.  RE: Using Composite Properties to Parameterize a Node

    Employee
    Posted 11-28-2019 10:18

    Hi Mick,

     

    I just imported the example data flow and executed on the current v.3.5.1 system and it produced the expected results:

    Did you recreate the property values on the node inside the Composite node and add the run time property values into those properties? Unlike with the textual substitution approach described in the response to your other post today, the node.properties... approach does not provide any 'broadcasting' of node values to the nodes within the scope of the Composite node, so each node that needs to access a property value needs to also have the property defined on it and the run time property value set to a unique value which corresponds to the attribute used in your Python code. You may find the textual substitution method is easier to use.