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.  Create decision node

    Employee
    Posted 06-12-2015 07:58

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

    Originally posted by: gabygyy

    hi,

    i want to create a decision node.
    The story is like this:
    we have a graph generic that is reading different files(same extension) with diferent no of columns and names.
    For eg:
    source file 1 aaa.txt has the columns:
    aa,bb,cc,kk
    Source file 2 bbb.txt has the columns:
    aa,cc,dd,kk
    We need to map almost always field bb to a new column ww.
    As you can see there are some cases when column bb is not present as a column in the source file.
    in this case we need to build something to work like this:
    if column is available(we can use a metacheck node) then map bb to ww
    if column is not available we need to extract value of bb from column kk and map this value to ww.
    The logic nedeed must work individualy with any of the mentioned source files.
    Note! any reference in the nodes to an non existing column will cause a failure to that node.
    Please advise if someone already did this!


  • 2.  RE: Create decision node

    Employee
    Posted 06-12-2015 08:03

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

    Originally posted by: stonysmith

    One question before I offer a solution:
    if you HAVE the column BB in the file, can that column ever have the NULL value?

    If not, there's a fairly simple way to deal with this.


  • 3.  RE: Create decision node

    Employee
    Posted 06-12-2015 08:11

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

    Originally posted by: gabygyy

    with the info that i have until now about the files / the field bb if it is part of the file structure it should not be null or empty.


  • 4.  RE: Create decision node

    Employee
    Posted 06-12-2015 08:20

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

    Originally posted by: stonysmith

    This should do the trick for you then.
    Notice that on the CAT node, the "union" option has been selected.
    Attachments:
    Merging Columns.brg


  • 5.  RE: Create decision node

    Employee
    Posted 06-12-2015 08:26

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

    Originally posted by: gabygyy

    hi, thx for your fast answer but this not cover the full request
    "The logic nedeed must work individualy with any of the mentioned source files.
    "
    first, the files are not loaded together! /same graph must run once to load source 1 and run once again to load source 2 without crash!


  • 6.  RE: Create decision node

    Employee
    Posted 06-12-2015 08:40

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

    Originally posted by: ryeh

    That's clever, Stony! Here's a "brute force" method. I thought I could use the "try" function, but didn't seem to work for me.
    Attachments:
    twoFields.brg


  • 7.  RE: Create decision node

    Employee
    Posted 06-12-2015 08:42

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

    Originally posted by: ryeh

    Gabygyy, regarding your last comment, what you can do is have the second data source be just one field - bb - with no records. That way, if 'bb' does not exist in the first source, a 'bb' column of nulls gets appended. Your input file will go into the first pin of the Cat node.


  • 8.  RE: Create decision node

    Employee
    Posted 06-12-2015 08:50

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

    Originally posted by: gabygyy

    yes i now the trick with cat but please note that the files are not related these must be treated individualy by the same graph. i will try the graph received.


  • 9.  RE: Create decision node

    Employee
    Posted 06-12-2015 09:29

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

    Originally posted by: gabygyy

    i think this was the best and fastest answer/ thx guys!
    the solution proposed by ryeh, who help me also in the past,passed the first tests!