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.  Do output

    Employee
    Posted 01-18-2013 01:51

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

    Originally posted by: aop

    Hi!

    I'm trying to create an output that is not based on input data. How can I use the do output function? I tried to paste the example found in the brainscript help to a filter but it seems I'm missing something as i get an error saying "corresponding output statement must precede 'do output'.

    The example I tried is this:
    while i < 50
    {
    do output 1
    {
    emit 1 as One
    }
    i = i + 1
    }


  • 2.  RE: Do output

    Employee
    Posted 01-18-2013 08:59

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

    Originally posted by: stonysmith

    You have to have an "output" statement first:

    ======================
    output 1 {
    emit 0 as One
    where false
    }

    while i < 50 {
    do output 1 {
    emit 1 as One
    }
    i = i + 1
    }
    ======================
    The "where false" is important so that the statement doesn't get executed an extra time, but rather only when you call the "do output". Any where condition in the original "output" statement is ignored when the "do output" statement is executed.

    It's also important to know that this entire set of code will be run for EACH input record. If you have two input records, you'll get 100 output records.