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.  Search across Fields

    Employee
    Posted 10-31-2014 03:46

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

    Originally posted by: dialpemo

    I am trying to filter across multiple fields, my problem is that I can't be certain which field has the character I am looking for. I was wondering if there is way of doing this for example using the python filter node.


  • 2.  RE: Search across Fields

    Employee
    Posted 10-31-2014 05:02

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

    Originally posted by: ejones

    We probably need more information to answer this. What are you needing?

    In BRAINscript you can use "pos = strFind(field,searchStr)" and since you provided the field name, you know which field you searched and where the value is.


  • 3.  RE: Search across Fields

    Employee
    Posted 10-31-2014 06:56

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

    Originally posted by: dialpemo

    Well I am bringing a csv, and where there is an empty record, it brings it as "-", the problem is that some of the fields are numbers and it could have negative numbers, thus if I were to use the replace text node it will change negative number to positives, so I want to replace the "-" either with empty or 0. I done it so far by using a split and a the replace node , but some of the csvs I am bringing could have more than 30 fields, and I don't want to write a condition for each field, but to do a loop across all the fields.


  • 4.  RE: Search across Fields

    Employee
    Posted 10-31-2014 08:44

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

    Originally posted by: ryeh

    This is a bit tricky, it's easy enough to go through all the fields and look for dashes. We can also go through and look for fields with only dashes and replace. The tricky part is how to output the replacements. The only way I can think of doing this dynamically is compiling a new set of data with the field name and new values (replace if "-", otherwise keep original), then pivot. A bit round-about, but that's what I can think of.

    P.S. The main take-away here is to use 'inputFields', which gives you the list of input fields. Then 'field' evaluates a field given the name. So using the combination of the two allows you to dynamically search through all the fields.
    Attachments:
    replaceDashes.brg


  • 5.  RE: Search across Fields

    Employee
    Posted 10-31-2014 08:53

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

    Originally posted by: ejones

    This sounds like an interesting challenge. There are multiple answers, that depend on the details of what you need and the environment where this runs.

    How about this?
    Use the lal1::Get Metadata node to retrieve the fields. In a Filter node you can generate the BRAINscript code that you would put into a Filter node to do this on the original input.

    A generic solution could involve the Pivot nodes.


  • 6.  RE: Search across Fields

    Employee
    Posted 11-02-2014 02:06

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

    Originally posted by: andycooper

    A great reply from Roger. On a more simple note if this isn't a process that needs to be repeated (i.e. if the values only need correcting once and then the columns the values occur in does not change) then you can use the Find option within the BRD viewer.


  • 7.  RE: Search across Fields

    Employee
    Posted 11-03-2014 03:11

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

    Originally posted by: dialpemo

    Thank you guys for all your help.
    I am going to use a combination of all three suggestions.