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.  Counting across columns

    Employee
    Posted 07-19-2016 08:50

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

    Originally posted by: austenr

    Is there a way to check to see if the word "yes" appears in certain columns in a record then make a count of them and put it in a new column?


  • 2.  RE: Counting across columns

    Employee
    Posted 07-20-2016 06:02

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

    Originally posted by: awilliams1024

    Hi, there are a number of ways to accomplish this:


    Counting_across_columns.brg


    Regards,
    Adrian


  • 3.  RE: Counting across columns

    Employee
    Posted 07-20-2016 09:42

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

    Originally posted by: ltolleson

    The code below will also do what you are asking. This code will work for any number of fields and does not require knowing the field names.

    Simply copy and paste this code into a filter node. You could also parameterize the node to allow users to input a string to search.

    fields = map(&field, inputFields())
    
    fieldCount = 0
    i = 0
    
    while i < fields.len()
    {
        if fields.getItem(i).str().strFindI("yes") > -1 then
             fieldCount = fieldCount + 1
        i = i + 1
    }
    
    emit *, fieldCount 
    #where fields.find("yes") > -1