Data360 Analyze

 View Only
  • 1.  Do While Example (d360)?

    Posted 01-29-2021 08:08

    are there any good examples for the Do While loop node? Is it still using BRAIN script?

    Basically I have a list of data (24 rows) and I need to perform a function on each row (creating a file, uploading to an FTP, etc) then moving on to the next one.. The help page still shows brainscript so I was hoping there was a sample with python?

    Thanks!

     



  • 2.  RE: Do While Example (d360)?

    Employee
    Posted 02-01-2021 08:53

    Node examples are found within the product's installation directory:

    <install home>/docs/samples/nodes/

    These are standard LNA files (data flow exports) that can be imported. There's around 70 or so examples, which include the Do While node.. 

    Also, within the in-product help, there's a walkthrough of how the Do While node works. You can access this by:

    1. Drag and drop the Do While node to the canvas
    2. Click on the node, and within its properties pane near the top, look for Type: Do While  and click the hyperlink to your local doc

    The above steps can also be performed on other nodes for more detailed information. 

     



  • 3.  RE: Do While Example (d360)?

    Posted 02-01-2021 09:16

    I dont think i can access that folder.. im checking. But I asked because the sample that it points to, uses Brainscript...

    UPDATE: i found the samples, and these also still use brain script... is this correct? Shouldnt these have been updated like other nodes?

    # Set condition to true on the first pass
    if (firstExec) then condition = true
    
    #Increment count by 1
    emit 'count' + 1 as count
    			
    # check if the condition is matched
    condition = condition and (20 > 'count')
    			
    # After all records are processed, check if the condition is still true.
    if (lastInGroup and condition) then {
    # If the condition is still true, set returnCode 101 to # reschedule the node and continue iteration. setSuccessReturnCode(101) }

     



  • 4.  RE: Do While Example (d360)?

    Employee
    Posted 02-02-2021 09:17

    Unfortunately, the Do While and Do While Conditional nodes still require the use of the legacy scripting language rather than Python.

    You can however include Python-based nodes in nodes that are within the loop.

    The attached data flow provides equivalent examples that utilize current nodes instead of the Superseded nodes in nodes in the loop.

     

     

    Attached files

    Example Do While Nodes - 2 Feb 2021.lna

     



  • 5.  RE: Do While Example (d360)?

    Employee
    Posted 02-02-2021 09:23

    You can also use looping constructs within a Transform node to perform some repeated actions.