seothtt 1 Posted September 27, 2012 Report Share Posted September 27, 2012 I have list A which is a list of folder names being pulled into my bot, then I have list B which is a list from a UI Block Text. I want to see if the number from list B is in list A or not. I did an IF statement, using $Contains as the condition, it seems to work, but not quite right. Say list A has 36078 and list B has 36. With what I have right now, it comes back saying yest list A contains 36 from list B. So I know $Contains is not what I want, but I'm not sure what to use. I believe its going to be a $comparison, but how do I set the values, since both are list. Quote Link to post Share on other sites
Legend 181 Posted September 28, 2012 Report Share Posted September 28, 2012 Something like this work: if($comparison($list total(%ListA), "=", $list total(%ListB))) { then { set(#equal, "Yes", "Global") }} Quote Link to post Share on other sites
seothtt 1 Posted September 28, 2012 Author Report Share Posted September 28, 2012 I thought $List Total gives you the total number in a list. List A may have 500 rows, List B may have 10, but I want to see if all 10 in List B are in List A. So if List A has 1000 to 2000 And List B has three numbers, 1001,1002,3004 I want to see this 1001, Yes1002, Yes3004, No I'll try what you have there, I may be misunderstanding what all the $List Total returns. Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted September 28, 2012 Report Share Posted September 28, 2012 clear list(%List A)clear list(%List B)clear list(%results)add list to list(%List A, $list from file(""), "Delete", "Global")add list to list(%List B, $list from file(""), "Delete", "Global")set(#temp, 0, "Global")loop($list total(%List B)) { if($contains(%List A, $list item(%List B, #temp))) { then { add item to list(%results, "{$list item(%List B, #temp)},Yes", "Delete", "Global") } else { add item to list(%results, "{$list item(%List B, #temp)},No", "Delete", "Global") } } increment(#temp)} Quote Link to post Share on other sites
Legend 181 Posted September 28, 2012 Report Share Posted September 28, 2012 Ah... I thought you were just wondering if the lists matched or not... In that case you need to loop through List A one at a time with the contents of List B, then record whether or not they match in table or in a column of a csv file. <code removed> **update... TJ beat me to it... and as usual, his code blows mine away, so I'll defer to the master... Quote Link to post Share on other sites
seothtt 1 Posted September 28, 2012 Author Report Share Posted September 28, 2012 Sweet, well thanks to both of you. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.