List Problem with null

I use the blocks below to form a list from a variable. I want to use that variable an infinate number of times with different variable results. To do this I have been trying to reset the variable to null to try and stop the procedure replicating the result. However setting the variable to null gives me null list results. How can I make it so that if the variable is made null, the procedure will not add results.

  1. Can't see where you set a variable to null (do you mean empty?)
  2. Might be better to use a for each loop than the while test, and perhaps use the break block ?

!. Yes empty. If I hit the button again, I don;t want any empty list entries.
2. I don't know what you mean. Break block?SetOrder03

Try like this ?

@TIMAI2 Thank you for that. Haven't tried it yet, had to get some sleep. From reading it, it seems that your solution will take out any 'empty' list items, but will not prevent them from happening. I would prefer the latter to be gone.

in which case:

@TIMAI2 Your blocks do give a solution, and I have no problem with them. However because I am using a menu scenario it is possible for a user to click on a button which generates an empty list item. Your blocks rectify the problem by eliminating those items, but I would prefer that they cannot happen in the first place. A potential solution I have worked out is to eleminate the button click, and place all the blocks inside the after scan event, so that adding the scan result to the list happens all at once. What do you think?

Well, yes, better to sort the problem out before it happens!

Why not use an if statement in the offending button click event to test for an empty item, if empty do nothing or get rid, if not empty, then add to the list.

@TIMAI2 Yes, that is another solution. And maybe I should have thought about it before. Sometimes I get lost. As I learn AI2 I try to think about all scenarios that can cause problems, and during that process I outhink myself and get myself into more enigmatic problems.