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.  Mid() Function - BrainScript - Nodes

    Employee
    Posted 08-31-2015 09:51

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

    Originally posted by: Brad Brezinski

    Hello,

    How do we do we use the mid() function with lavastrom nodes? To clarify, in the examle below, we want to exclude instances in which the 4th postion of the field is “R”.

    Got it:

    CIR_Char4 = Mid(CIRCUIT_IDENTIFICATION_CD, 3, 1)
    emit *, CIR_Char4
    where CIR_Char4 =="R"

    Alternate Question:

    How do we use the split()?

    CIR_Char4 = Mid(CIRCUIT_IDENTIFICATION_CD, 3, 1)
    CIR_Array = split(CIRCUIT_IDENTIFICATION_CD, "/")

    emit *, CIR_Char4, CIR_Array
    where CIR_Char4 =="R"

    The split() creates a list of strings. How do we reference the individual strings? In the example above, CIRCUIT_IDENTIFICATION_CD might = "10/123456/ABCD/AB1".

    Thanks,
    Brad


  • 2.  RE: Mid() Function - BrainScript - Nodes

    Employee
    Posted 08-31-2015 17:30

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

    Originally posted by: ryeh

    See attached. The equivalent of the Excel 'mid' function is 'substr'. Just remember that we are zero-based, so the fourth position is 3, as you've stated above.

    Like you said, split creates an array. Use the 'getItem' function or []s to get the element you need. So something like:
    getItem(cirArray,2)
    or
    cirArray[2]
    Attachments:
    substr_split.brg