Skip to main content
santiagoc0005
January 5, 2023
Question

How to group repeated values ​​in a table

  • January 5, 2023
  • 8 replies
  • 0 views

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

/resized-image/__size/320x240/__key/communityserver-components-multipleuploadfilemanager/e7419661_2D00_e8f0_2D00_4b40_2D00_9d0d_2D00_44f18f7d1bd9-92092-complete/pastedimage1672865100983v2.png

    8 replies

    davel001150
    January 5, 2023

    The absolute simplest way there is to remove duplicates:  union(local!list, local!list)

    davel001150
    January 5, 2023

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

    santiagoc0005
    January 5, 2023
    Thank you very much for your answer, how could I relate each user with its corresponding value? 
    For example I need to assign the corresponding user: James: 4,5,6 Jeff: 1,2,3 Mike: 7,8,9

    Currently the values come out like this:

    Santiago: 1,2,3,4,5,6,7,8,9
    Jeff: 1,2,3,4,5,6,7,8,9
    Mike: 1,2,3,4,5,6,7,8,9
    mikes0011
    Brainy
    January 5, 2023
    1. i don't see any image, you might want to check that your post worked correctly
    2. what's your use case? some more detail about the shape of your data, where you're accessing it from, and what you hope to do with it / how / why, would be helpful in helping formulate some sort of answer or suggestion - as it stands, i can't even tell whether you're after some sort of DB solution, view, interface technique/trick, or something completely different.
    The Expression Guru
    santiagoc0005
    January 5, 2023

    Hi Mike, apparently the image did not upload correctly. The data is consulted through record types and displayed in a grid

     

     

    The question is how could I assign the values of the "Importes" column to the "Directores" 
    column as appropriate

     

    Currently the values come out like this:

    For example:

    James: 1,2,3,4,5,6,7,8,9

    Jeff: 1,2,3,4,5,6,7,8,9

    Mike: 1,2,3,4,5,6,7,8,9


    and i need something like that

    James: 4,5,6

    Jeff: 1,2,3

    Mike: 7,8,9

    mikes0011
    Brainy
    January 5, 2023
    assign the values of the "Importes" column to the "Directores"
    column

    I guess what i'm unclear on here is what the basis of the "assignment" is supposed to be?  Do the items have some sort of inherent relationship due to the DB, or are you just hoping to evenly split up the "importes" evenly between the different "directores"?

    The Expression Guru