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 new column if

    Employee
    Posted 10-29-2012 06:17

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

    Originally posted by: carlos

    Hi,

    I�m trying to emit a new column that takes a value acording to another column

    baja --> programable
    media --> programable
    alta --> critica

    I take a filter and I program as that:

    if ('criticidad'== "baja" or 'criticidad'=="media" ) then
    a = "programable"
    else if 'criticidad'=="alta" then
    a = "critica"

    emit 'criticidad',a


    but in the a column I allways get null value

    can anyone help me.

    thanks in advance.


  • 2.  RE: Emit new column if

    Employee
    Posted 10-29-2012 07:04

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

    Originally posted by: stonysmith

    change your emit statement:

    emit a as "criticidad"
    or
    emit criticidad = a


  • 3.  RE: Emit new column if

    Employee
    Posted 10-29-2012 08:23

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

    Originally posted by: carlos

    If I change the statment to

    emit a as "criticidad"
    or
    emit criticidad = a


    I�m geting only one column but the values are still null values for all the cells

    I�ll try to explain what I need,
    now with that:

    if ('criticidad'== "baja" or 'criticidad'=="media" ) then
    a = "programable"
    else if 'criticidad'=="alta" then
    a = "critica"

    emit 'criticidad',a


    I�m geting that output in the filter (criticidad is a input column to the filter)

    criticidad a
    Baja NULL
    Baja NULL
    Baja NULL
    Baja NULL
    Baja NULL
    Baja NULL
    Media NULL
    Baja NULL
    Baja NULL
    Baja NULL
    Baja NULL
    Alta NULL
    Baja NULL
    Baja NULL

    But I would like to have this output in the filter

    criticidad a
    Baja programable
    Baja programable
    Baja programable
    Baja programable
    Baja programable
    Baja programable
    Media programable
    Baja programable
    Baja programable
    Baja programable
    Baja programable
    Alta critica
    Baja programable
    Baja programable


  • 4.  RE: Emit new column if

    Employee
    Posted 10-29-2012 08:37

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

    Originally posted by: mmarinelli

    I think the problem might be with the source strings. If you are trying to find "Baja" and instead you're finding "baja", your logic won't be triggered and you will end up with a NULL output. Also, if there are spaces in the source field, you will not get a match. A better approach would be to use the equalsI() function, which is case-insensitive, and to ensure that the input strings have been trimmed of white space prior to your filter. If this doesn't fix the problem, could you provide a few lines from the source file as an attachment so we can help diagnose the issue?


  • 5.  RE: Emit new column if

    Employee
    Posted 10-29-2012 08:46

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

    Originally posted by: carlos

    Originally posted by: mmarinelli
    					

    I think the problem might be with the source strings. If you are trying to find "Baja" and instead you're finding "baja", your logic won't be triggered and you will end up with a NULL output. Also, if there are spaces in the source field, you will not get a match. A better approach would be to use the equalsI() function, which is case-insensitive, and to ensure that the input strings have been trimmed of white space prior to your filter. If this doesn't fix the problem, could you provide a few lines from the source file as an attachment so we can help diagnose the issue?
    Thanks Mmarinelli, the problem was the first capital letter, now it is working.