LAE

 View Only
  • 1.  Using a simple loop in python

    Posted 07-14-2020 00:09

    Hi All

    I have the following code to sum the field name in the node input pin. I understood that there are nodes that can perform task easily, but I just curious and like to get it done in python
    I have a sales column as the input node column and want loop over the column adding each sale in sales to variable total with the result 360 dollars.

    Below would be an example in python

    def sum_of_list(l):
      total = 0
      for val in l:
        total = total + val
      return total
     


  • 2.  RE: Using a simple loop in python

    Employee
    Posted 07-14-2020 04:28

    There is a guide to using the Python node that is installed with BRE named "Python Node Getting Started.pdf". It should be included in the following directory:

    <InstallDir>\docs 

    For example:

    C:\Program Files\Lavastorm\LAE6.1\docs

    The Python node is intended for advanced uses and it is recommended that other nodes (e.g. Agg Ex or Filter) are used as they can achive a simple summation of values without the code overhead of using the Python node. However, an example is attached for your reference.

     

     

    Attached files

    Python_Node_Sum_Input_Field_Values.brg