Jump to content
UBot Underground

Count Repeating Numbers In A List


Recommended Posts

Hello -

 

Hoping someone can help me with this...I've pulled data from a column in a table and added it to a list. The data is just repeating numbers that are either 1,2 or 3. I need to get a total count of each of those numbers to put in variables i.e. 3 one's, 4 two's etc.

 

I've tried every way I can think of and not good with regex so if anyone has a simple way to do this I'd appreciate it.

 

Thanks 

Link to post
Share on other sites

there is probably a better way to do this,as was a lot of new list functions added recently,havn't learned them yet,change the %myList to your list name on the add list to table as column

define $DuplicatesCount(#Duplicate) {
    add list to table as column(&Results,1,1,%myList)
    set(#counter,0,"Local")
    loop while($comparison($plugin function("TableCommands.dll", "$table search", &Results, #Duplicate, "Row Index"),">","-1")) {
        set table cell(&Results,$plugin function("TableCommands.dll", "$table search", &Results, #Duplicate, "Row Index"),1,"")
        increment(#counter)
    }
    clear table(&Results)
    return(#counter)
}

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...