LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only

Bypass and Switch nodes don't wait for both inputs

  • 1.  Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-05-2016 17:08

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dglavastorm

    Hi - not sure if I'm doing something wrong, but i'm trying to add some sort of switch into my graph that outputs 1 of 2 inputs based on whether they run.

    The Bypass and Switch should do this from what I understand from the description, but they aren't waiting for the second input to complete and as such just passing along the first to reach it.

    Am I doing something wrong ? This may not be the best option for what I'm trying to achieve.

    Full description

    An X-Ref node checks for new data and outputs either existing data on the middle pin or the filename of the new data on the Right pin.

    The right pin feeds into an Acquisition node which brings in new data and Cats it to the existing data.

    What I'm trying to achieve is :

    With the X-Ref node, if there is no new data (right pin has 0 output) then the existing data (middle pin) is passed along, but if there is new data (right pin outputs a filename) then the graph holds until the new data is imported, then passes this new combined dataset along instead of the middle pin's output.

    Because it takes time to import the data, both the Bypass and Switch are simply taking the middle pin input every time.

    I can't clock the right pin import node to the Bypass either, because if there is 0 data then it errors and the Bypass won't run.


    Hope that makes sense

    Edit - I have solved my issue using the Metacheck node with ClockWithPropagate for 0 data, but the confusion around Bypass still remains.


    Using the Bypass nodes in two parts of my graph - at one point it simply takes the first lot of data that arrives and doesn't wait for the second, then at another point it waits for the second input to arrive.

    What triggers this wait/don't wait ?


  • 2.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-05-2016 18:10

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    Sorry, but neither Bypass nor Switch do what you're looking for. Neither of them do their work based upon the clock on the wall.

    ====================
    Bypass operates simply upon whether it is possible for data to arrive at the node or not.
    It has nothing to do with "when" the data becomes available.. it's only whether the input(s) are enabled or disabled.

    Imagine a Bypass node that has two inputs.
    - As long as the first input is ENABLED, then the Bypass node will use that data, ignoring the other pin.
    - If the first input is DISABLED, then the Bypass node will use the data from Pin2.


    ====================
    Switch is to be used for looping. There is a special mechanism for telling the Switch node to reset, causing everything after it to re-execute.
    - The first time thru the loop, the node will use data from the first input pin.
    - Any subsequent times that the node is executed, if the 2nd pin is connected, then the Switch node will use that data.


  • 3.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-05-2016 19:46

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dglavastorm

    ok thanks - out of interest, is there any script you can put into a filter node for example that would cause it to Disable if conditions are met and thereby the Bypass takes the other dataset ?

    Just trying to make my graphs as automated as possible


  • 4.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-06-2016 08:10

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: awilliams1024

    Here is a dataflow that shows how to use a boolean parameter to disable a node.
    The example doubles the value of the 'id' field when the parameter on the Composite is true.
    You could also use graph/ runtime parameters to set the value.

    Disable_Node_Using_Parameter.brg


    You need to ensure a default value is set for the parameter else you will get an error about the parameter not being defined.
    In this case the default value is set by the 'false' string in the following statement: {{^DoubleTheValue=false^}}

    For further information on parameters, see the 'Parameters' section in the 'General Language Sections' chapter of the online help in BRE.


  • 5.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-11-2016 23:54

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dglavastorm

    Champion, thanks


  • 6.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 06-08-2016 17:35

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dglavastorm

    HI Awilliams - I've returned to this issue a couple of months later when trying to optimize the graph.

    With the example you provide, is the node enabled/disabled due to logic in the graph, or through manually changing the setting from true to false in the composite settings ?


  • 7.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 06-09-2016 06:45

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ejones

    I'm glad you solved it. I've found those more complex clocking operations to be difficult to understand. I've solved this type of problem by creating a dummy file that is used instead in a "no data available" situation.


  • 8.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 06-09-2016 07:37

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: awilliams1024

    Hi dglavastorm,

    Re. "With the example you provide, is the node enabled/disabled due to logic in the graph, or through manually changing the setting from true to false in the composite settings ?":

    At the composite level the operation is controlled by the user by selecting true or false (which is also the default value) on the 'DoubleTheValue' parameter. When the data flow is run the value of the parameter is inspected as part of the compilation of the data flow. This constant literal value is used to controls the enabled/disabled status of the nodes within the composite. If you open the composite and look at the 'Enabled' property of the two filter nodes (on the Logistics tab) you can see that the 'other' radio button has been selected and the property value field contains the criteria that results in the final boolean value which determines whether the node is enabled or disabled.

    So, for the upper Filter node in the composite, the criteria is:

    not({{^DoubleTheValue=false^}})

    In this case the default value for the parameter is set to false to cater for the situation where a value has not been set for the 'DoubleTheValue' parameter. If a value is set it takes precedence over the default value. When the parameter is evaluated at compile-time, the value replaces the parameter name (i.e. it 'dissolves away') so the default expression would be evaluated as

    not(false)

    Which in turn is evaluated as

    true

    So the upper node has an enabled status of 'true' and will be run as part of the dataflow.

    Conversely, the default for the lower Filter node is evaluated to be a 'false' value -- as it's 'Enabled' criteria is just {{^DoubleTheValue=false^}} -- so it is disabled by default and won't be run.

    You could have also used a graph-level graph/run boolean parameter to control the enabled/disabled status of the nodes


  • 9.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-10-2018 09:37

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Arunn

    Hi,

    I tried to implement the below scenario using the Switch but it's not working as expected.. It's working fine in the first run but not in the consecutive run.

    Example :

    1) If the data is available in the input file, read the data from the input file and send it to filter node (Any node).
    2) If there is no data in the input file (zero records), then I want to read the data from the Static Data node and send it to filter node.

    Basically I want read the data from either Input file or Static Data node based on the input records.

    Thanks in advance


  • 10.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-11-2018 05:03

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: awilliams1024

    Hi Arunn,

    You may want to look at this alternative approach. Instead of using a Static Data node as a source of the default data the default data would be stored in another file (which could contain the Static Data node's content if required).

    http://community.lavastorm.com/threa...e-is-Not-Empty

    Regards,
    Adrian


  • 11.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-11-2018 13:08

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Arunn

    Thanks for your prompt response, Adrain !!

    I've given the example as like to read the data from the input file but I just want to implement this logic while processing the data. Attached the sample graph what I've tried to achieve.

    Record_Validation.JPG


  • 12.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-12-2018 05:01

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: awilliams1024

    You may want to look at using the Meta Check node.

    The attached shows how you can use the Meta Check node to determine whether the data contains at least one record. If so the data is passed to the Switch node, which passes through the data on its second (optional) input pin.
    If there are zero records the Switch node passes through the default data on its first input pin.

    Meta_Check_Node_Validation_of_Records_Present.brg


  • 13.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-12-2018 11:22

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Arunn

    Sorry. I couldn't download the attached BRG file as it's downloaded as PHP file.


  • 14.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-13-2018 01:28

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: awilliams1024

    I assume your browser is IE11 which exhibits this issue.

    You can either download the file and then rename the file to <graphname>.brg or use the <Right-Click> -> Save target as... dialogue to rename the file during the download process.

    Alternatively, the downloaded file name is correct if you use Chrome.


  • 15.  RE: Bypass and Switch nodes don't wait for both inputs

    Employee
    Posted 04-13-2018 07:17

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Arunn

    Thanks William !! It's working as expected.