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.  Two fields, same name

    Employee
    Posted 12-11-2014 05:03

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

    Originally posted by: zon

    Hi,

    Need your help to solve an issue.
    I have a table in LAE, that results from a Phyton node, that has two fields with the exact name, but with different data.
    I want to keep them both, but when I execute the next node, it coverts one of them to have the same data.
    How can I avoid this, and even change the name of one of that fields?

    Best Regards
    NOS


  • 2.  RE: Two fields, same name

    Employee
    Posted 12-11-2014 08:55

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

    Originally posted by: prashanth

    Could you please clarify? How do you have a db table that has two column names that are identical? Or is it the output from the node?

    Thanks


  • 3.  RE: Two fields, same name

    Employee
    Posted 12-11-2014 08:59

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

    Originally posted by: zon

    It's the output of the Phyton node.
    It has two fields with the same name, but different data.

    Thanks


  • 4.  RE: Two fields, same name

    Employee
    Posted 12-11-2014 09:11

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

    Originally posted by: stonysmith

    The first (best) choice would be to fix the Python if you can.

    If the column number is known (and doesn't change), you can use this syntax:

    emit *
    rename '1:13' as MyField1 #column number for first field
    rename '1:25' as MyField2 #column number for second field


    If that won't work, there may be a more complicated approach that we can try.


  • 5.  RE: Two fields, same name

    Employee
    Posted 12-11-2014 09:22

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

    Originally posted by: zon

    Will try.
    Just two questions: it starts in 1:0 or 1:1?
    And can I do that in a filter node after the phyton, like this:

    emit *
    rename '1:7' as COST_CODE
    ?



  • 6.  RE: Two fields, same name

    Employee
    Posted 12-11-2014 13:04

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

    Originally posted by: ejones

    It starts with 1:1 for the first field in the first input.

    Thanks Stony, I had no idea it was this simple and was off searching for a more complicated answer.


  • 7.  RE: Two fields, same name

    Employee
    Posted 12-12-2014 02:32

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

    Originally posted by: zon

    Thanks.

    I did this:

    emit *
    rename '1:7' as COST_CODE

    ...and it turned out error:

    Unexpected token ( 1 ) at line 3
    Expected string or identifier to rename.

    Am I doing something wrong?


  • 8.  RE: Two fields, same name

    Employee
    Posted 12-12-2014 07:18

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

    Originally posted by: prashanth

    Try this in your filter node:

    emit '1:7' as "COST_CODE"

    where 7 is the field index, starting with 1, you want to rename to COST_CODE (that was earlier conflicting with another name). 1 is the source index that is the only INPUT that is coming in to the filter node.


    Thanks


  • 9.  RE: Two fields, same name

    Employee
    Posted 12-12-2014 08:56

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

    Originally posted by: zon

    It worked!
    Thank you very much prashanth, ejones and stonysmith.

    NOS