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.  Collapse columns based on field name

    Employee
    Posted 09-22-2015 05:43

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

    Originally posted by: arkore

    In an effort to avoid developing a Python node I'm trying to figure out a BRAINscript method of identifying columns based on their field name and string cat them together and pipe the output to a single column. An example will make it much clearer:

    prefix|col1 prefix|col2 col3 col4
    ------------------------------------------------
    test data more data apple delta
    test aaa yesterday grape delta
    test bbb tomorrow cherry theta
    test cccc freedom orange apha

    With the output being:

    prefix col3 col4
    ------------------------------------------------
    test datamore data apple delta
    test aaayesterday grape delta
    test bbbtomorrow cherry theta
    test ccccfreedom orange apha


    I can get a list of the field names using inputFields("in1") but I need to split() each list element by a delimiter (i.e. "|") and then find which columns match the prefix. I think I need to use a combo of the apply() function but cannot get it to work for string operators like split().

    I would greatly appreciate any assistance or simply to be told I should just go with Python.


  • 2.  RE: Collapse columns based on field name

    Employee
    Posted 09-22-2015 14:22

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

    Originally posted by: ryeh

    Took a quick stab. Looks a bit clunky, but should work!
    Attachments:
    groupInputs.brg


  • 3.  RE: Collapse columns based on field name

    Employee
    Posted 09-22-2015 17:40

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

    Originally posted by: arkore

    This is absolutely fantastic, it does exactly what I needed including accommodating an unknown number of columns with a prefix. I should be able to package this up into a nice composite with some additional modifications.