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.  Filter/Split Node - getting complete output based on condition

    Employee
    Posted 01-17-2013 14:16

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

    Originally posted by: ADas

    Hi all,

    I have a question regarding the use of a filter node. I have data that has a number of rows and columns. What I want to do is have an output based on a condition - i.e. if 'X' is present in Row 1, output every entry, otherwise, do not output anything.
    Basically like this. The sort of data I'm dealing with:
    X,Blue,Red,Tuesday,February
    Y,Yellow,Black,Friday,December
    z,Green,Pink,Wednesday,January

    ...and so on.

    The output should be:
    if "X" is present in column 1, display all entries. Otherwise, do not display any entry.

    Any ideas on how to achieve this?

    Thanks.


  • 2.  RE: Filter/Split Node - getting complete output based on condition

    Employee
    Posted 01-23-2013 08:19

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

    Originally posted by: pdespot

    Hi, ADas.

    You’re on the right track with the filter node. What you want to do is add a condition to the “emit *” statement. “emit *” tells LAE to output all the columns and the condition will tell it which rows it should output. Using your data as an example, you’d want to do something like this:

    emit * where ‘Column1’ == “X”

    That will only output rows where Column1 is the string “X”. If it’s an integer, you can forego the quotes.


  • 3.  RE: Filter/Split Node - getting complete output based on condition

    Employee
    Posted 01-23-2013 16:44

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

    Originally posted by: ADas

    Hi pdespot,

    Thanks for your response. I've tried what you have suggested and that only gives me, as you said, the rows where Column1 is the string "X".
    The problem is that I need to output all if a condition is present. So for example, the data is:
    X,Blue,Red,Tuesday,February
    Y,Yellow,Black,Friday,December
    z,Green,Pink,Wednesday,January

    And I want it to be, if "X" is present in Column 1, then the output will be:
    X,Blue,Red,Tuesday,February
    Y,Yellow,Black,Friday,December
    z,Green,Pink,Wednesday,January

    but if "X" is not present in Column 1, then no output.

    Is there any way to do this?


  • 4.  RE: Filter/Split Node - getting complete output based on condition

    Employee
    Posted 01-23-2013 16:53

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

    Originally posted by: stonysmith

    try this:

    if firstExec and ‘Column1’ == “X” then usable = true else usable = false
    emit *
    where usable==true

    This will test the value of Column1 on the first record only, and then decide whether to put out the records accordingly.


  • 5.  RE: Filter/Split Node - getting complete output based on condition

    Employee
    Posted 01-23-2013 17:08

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

    Originally posted by: ADas

    Hi stonysmith, thanks!
    That does work - now, for another question (sorry for all the questions!):
    Is there any way to do it so it doesn't have to test the value of Column1 on the first record only? E.g. If I want to test for "X" in any record rather than just the header record?


  • 6.  RE: Filter/Split Node - getting complete output based on condition

    Employee
    Posted 01-24-2013 07:09

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

    Originally posted by: Wizardous

    Hi ADas

    I have a solution for you. It's not a single node but it works fine i think. I put some parameters and composited it for you. If there is no "X" in Column an error message will occur. If there is any "X" in Column whole data will be outputted.

    Here it is Value check.brg

    Regards

    Ozgun


  • 7.  RE: Filter/Split Node - getting complete output based on condition

    Employee
    Posted 01-24-2013 07:17

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

    Originally posted by: rboccuzzi

    I think the Filter by Group node does exactly what you want. Attached is an example of it, but basically, use Filter by Group, and set the GroupBy expression to 1, and the PredicateExpr to be 'FlagField' == "X" and the GroupFilter to "Any"

    Cheers
    Rich
    Attachments:
    Filter By Group Example.brg


  • 8.  RE: Filter/Split Node - getting complete output based on condition

    Employee
    Posted 01-28-2013 17:37

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

    Originally posted by: ADas

    Excellent, thanks everyone for your help.