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.  Emit field only if it exists in input

    Employee
    Posted 10-28-2013 05:40

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

    Originally posted by: aop

    Hi!

    What could be the best way to emit a field only in case it exists in input data?

    Currently I have (however this doesn't work if Field2 is not present):
    emit Field1, Field2

    Field1 is mandatory, Field2 is not present in all data sets I'm going to run the project for. I'm not going to combine data sets of these two types in a same project but rather to create one standard BRE project template I could use every time for certain type of analysis regardless of existence of Field2 in the data. Due to the template approach I do not want to change the code (=remove "emit Field2" from the statement manually if it doesn't exist).

    I just figured I could use the following to be able to run a node succesfully even if Field2 is not present in the data:
    emit Field 1
    emit wildcard "Field2"

    I think this basically does what I'm looking for, however, I'd just like to know whether there's some better way to build this type of emit statement?


  • 2.  RE: Emit field only if it exists in input

    Employee
    Posted 10-28-2013 07:43

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

    Originally posted by: stonysmith

    Depending upon how many fields you are dealing with, it might be simpler to just:

    emit * # writes out ALL fields that are present on the input
    exclude Field3,Field4,Field5