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.  Group Counts

    Employee
    Posted 08-24-2016 07:45

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

    Originally posted by: moko

    Hi,

    I need help in implementing a logic in lavstorm. I have a data set like below
    ID List Count of values in list
    123 (Yes, No, Yes, No, Yes, Yes) 6
    456 (Yes, No, No) 3
    789 (No, Yes, No, No) 4


    I would like to count the number of Yes and No against each ID field and get output something similar to the below

    ID CountYes CountNo
    123 4 2
    456 1 2
    789 1 3


    Can you please let me know how to do it in LAE?


  • 2.  RE: Group Counts

    Employee
    Posted 08-24-2016 08:00

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

    Originally posted by: stonysmith

    There are many ways to solve this.. here is one: Copy this code and paste it into your graph.

    node:Filter
    bretype:core::Filter
    editor:sortkey=57bdb4a6540450f4_2
    input:@40fd2c74167f1ca2/=Static_Data.40fe6c55598828e5
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    s=List.replace("(","").replace(")","").replace(" ","")
    s=s.replace("Yes","Y").replace("No","N").replace(",","")
    Length=strlen(s)
    N=strlen(s.replace("Y",""))
    Y=Length-N
    emit Id,Count,'List',s,Y,N
    EOX
    editor:XY=240,220
    end:Filter