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.  Indexing

    Employee
    Posted 01-20-2016 08:22

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

    Originally posted by: akash_123srm

    Hi I want to fetch specific value of a column field. Is it possible to fetch the specific value by indexing in BRAIN Script. Lets say I have a column of the Kind-

    COUNT

    0
    2
    6
    9
    0
    0
    0

    I want to fetch the value in the 4th row i.e. 9 . Is it possible to do something like COUNT[4] to get this value where 4 is the index?


  • 2.  RE: Indexing

    Employee
    Posted 01-20-2016 13:57

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

    Originally posted by: belliveaujd

    This should give you a couple of ways to accomplish this:

    1. Uses the RecordNumber function
    2. Uses the ExpandToList node, combined with the Split function

    node:Static_Data
    bretype:core::Static Data
    editor:sortkey=569ff3712c271560
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    COUNT:int
    0
    2
    6
    9
    0
    0
    0
    EOX
    editor:XY=350,140
    end:Static_Data
    
    node:Reduce_To_List
    bretype:core::Reduce To List
    editor:sortkey=569ff43d5cb91c18
    input:@3fba65925f181f9b/=Static_Data.40fe6c55598828e5
    output:@3fba65920bf11dfc/=
    prop:GroupBy=<<EOX
    1
    EOX
    prop:ItemField=COUNT
    editor:XY=460,240
    end:Reduce_To_List
    
    node:Filter
    bretype:core::Filter
    editor:sortkey=569ff3ab3f4c7a7d
    input:@40fd2c74167f1ca2/=Static_Data.40fe6c55598828e5
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    
    emit count as fourthItem
    where recordNumber() == 4
    EOX
    editor:XY=470,140
    end:Filter
    
    node:Get_the_4th_Item
    bretype:core::Filter
    editor:Label=Get the 4th Item
    editor:sortkey=569ff45d294a4365
    input:@40fd2c74167f1ca2/=Reduce_To_List.3fba65920bf11dfc
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    _fourthItem = 'COUNT-list'.split("*")[4]
    emit _fourthItem
    EOX
    editor:XY=560,240
    end:Get_the_4th_Item