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.  Data field phrase search

    Employee
    Posted 02-11-2013 09:54

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

    Originally posted by: rbeliz000

    Greeting members of the forum,

    I'm looking for the best way to do the following using the attached sample data for reference:
    - add new column called "VIP" to every record
    - if field "switch" contains the following phrases "lovepark or "sponsor", update "VIP" field with "Yes"
    - if field "switch" does not contain the phrases "lovepark or "sponsor", update "VIP" field with a "No"

    the phrases of interest could be in any position within the data field
    the data source is an output to an xref node
    the data source is an excess of 10 million records with 10 columns of data



    account_number switch service color day VIP
    10050 d11_lovepark36.tn platinum red mon Yes
    10051 d11_v_tm722gims_silver_c02.lm gold yellow mon No
    10052 d11_v_dhg535_silver_c02.pm gold blue tue No
    10053 d11_v_sponsor_c02.pm bronze orange sat Yes
    10054 tl90_loveparkswiss.tn gold purple fri Yes

    thanks,
    rbeliz000
    Attachments:
    lavastorm_forum.txt


  • 2.  RE: Data field phrase search

    Employee
    Posted 02-11-2013 15:29

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

    Originally posted by: stonysmith

    Add a filter, and use this BrainScript

    VIP="No"
    if switch.strFindI("lovepark") > -1 or or switch.strFindI("sponsor")> -1 then VIP="Yes"
    emit *
    emit VIP

    ====
    This works for a small number of search strings. If you need a large number of search strings, then the IF logic abov eshould be turned into a loop.


  • 3.  RE: Data field phrase search

    Employee
    Posted 02-11-2013 17:49

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

    Originally posted by: rbeliz000

    Originally posted by: stonysmith
    					

    Add a filter, and use this BrainScript

    VIP="No"
    if switch.strFindI("lovepark") > -1 or or switch.strFindI("sponsor")> -1 then VIP="Yes"
    emit *
    emit VIP

    ====
    This works for a small number of search strings. If you need a large number of search strings, then the IF logic abov eshould be turned into a loop.
    it works nicely.

    thank you.


  • 4.  RE: Data field phrase search

    Employee
    Posted 02-11-2013 17:56

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

    Originally posted by: rbeliz000

    the actual syntax used in my filter node.

    WalledGarden_Abuse="No"

    if DEVICE_COS.strFindI("walledgarden") > -1 or DEVICE_COS.strFindI("abuse")> -1 then WalledGarden_Abuse="Yes"
    emit *
    emit WalledGarden_Abuse