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
  • 1.  How to utilize the number on the output pin for a node

    Employee
    Posted 12-11-2014 14:11

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

    Originally posted by: the1don

    I am running a DB Execute node (but all nodes work similarly). The output pin displays a number, 0 if there are no records or a positive number if there are records. Is there a way to use that number in a filter node.

    So I have my DB Execute output pin tied to a filter input pin. The script on the input pin would be something like

    If {input pin value} == 0 then
    message = " No records found"
    else
    message = "You have records"

    emit message


  • 2.  RE: How to utilize the number on the output pin for a node

    Employee
    Posted 12-11-2014 17:51

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

    Originally posted by: stonysmith

    Connect an AGG node to the pin... in GroupBy put simply "1"

    then for the Brainscript Code:

    c=count()
    message="No records found"
    if c>1 then message="You have " + str(c) + " records"
    emit message
    where lastInGroup


  • 3.  RE: How to utilize the number on the output pin for a node

    Employee
    Posted 12-12-2014 11:49

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

    Originally posted by: the1don

    Thank you for the idea and assistance. I found that the output on the DB Execute node returns either records or nothing. For example when I run a select count(*) from table (or select * from table) in a DB Execute node and there are no records in the table the pin will display a 0 which really indicates there is no data to return.When I run a DB Query node with the query select count(*) from table the pin will display 1 and the result will show 0 which is what I was looking for. Unfortunately I can't pass parameters into a DB Query. So the way I solved this was
    1. Run the DB Execute node
    2. Create a static node the matches the output from the DB Execute node
    3. Use the CAT node to cat the results from the DB Execute node to the Static node
    4. Use a filter node with similar code

    message = " No records found"
    c = count()

    if c >1 then
    message ="You have records"

    emit dup_message