Jump to content
UBot Underground

Comparing Lists: if list1 item exist in list2 then ignore function else perform?


Recommended Posts

Hi guys..

Im trying to create a logic:

 

Im trying to compare between 2 lists..

One list is loaded everytime the program opens, and that list is being used as reference for logs.

Im logging data like usernames so we dont repeat interactions.

 

So technically I need to compare list1 with list2 (fresh and recent)

So if data in list2 exist in list1, then ignore an action. Else then perform action required.

 

Really struggling with this.

Link to post
Share on other sites

I think there are 2 things you can do to accomplish what you want...

 

You can either subtract the lists so you only get unique records by doing something like this:

add list to list(%uniquelist, $subtract lists(%list1, %list2), "Delete", "Global")

or, you can check the list as you go like this:

add item to list(%list1, "test", "Delete", "Global")
add item to list(%list2, "test", "Delete", "Global")
set list position(%list1, 0)
set(#current_item, $next list item(%list1), "Global")
if($contains(%list2, #current_item)) {
    then {
        alert("list 2 contains item from list 1")
    }
    else {
        alert("perform action required")
    }
}

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