How to group repeated values ​​in a table

Hello everyone

We have a requirement where we must group repeated values ​​in a table, that is, as seen in the image, the name of a user appears 3 times, how to make it only appear once

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    For other operations, such as counting the number of times duplicated, that might take quite a bit more effort.  Only one kind of solution is below:

    a!forEach(
        items: union(local!list, local!list),
        expression: concat(
            fv!item,
            ":  ",
            length( wherecontains(fv!item, local!list) )
        )
    )

    Wherecontains spits out an index number for every time specified value appears in specified array, so if it's at position 5, 10, and 12, output is {5,10,12}.  So the length of that output is the number of times that value appears in the array.  You remove duplicates in the items definition so you don't have "Steve:5, Steve:5, Steve:5, Jeff: 1, Steve:5, Steve:5".

Reply
  • 0
    Certified Lead Developer

    For other operations, such as counting the number of times duplicated, that might take quite a bit more effort.  Only one kind of solution is below:

    a!forEach(
        items: union(local!list, local!list),
        expression: concat(
            fv!item,
            ":  ",
            length( wherecontains(fv!item, local!list) )
        )
    )

    Wherecontains spits out an index number for every time specified value appears in specified array, so if it's at position 5, 10, and 12, output is {5,10,12}.  So the length of that output is the number of times that value appears in the array.  You remove duplicates in the items definition so you don't have "Steve:5, Steve:5, Steve:5, Jeff: 1, Steve:5, Steve:5".

Children