Jump to content
UBot Underground

Can't Load Empty List


Recommended Posts

really beating my head against a wall here.

my code was working fine now all of a sudden I can't load a list from file and get empty

 

clear list(%test)
save to file("{$special folder("My Documents")}\\test.csv",%test)
add list to list(%test,$list from file("{$special folder("My Documents")}\\test.csv"),"Delete","Global")

 

when I run that I end up with a list with 1 blank item instead of a list with 0 items

 

https://www.screencast.com/t/6LhZ6eRmh

 

this messes up all the rest of the code.

this is just a new snipit of code I wrote to test my issue.

 

 

thanks and happy holidays!

 

Link to post
Share on other sites

I have fixed the issue although don't know why its all of a sudden an issue.
load the file in as a table then convert to list

 

create table from file("{$special folder("My Documents")}\\test.csv",&test)
clear list(%test)

add list to list(%test,$plugin function("TableCommands.dll", "$list from table", &test, "Column", 0),"Delete","Global").

Link to post
Share on other sites

I think its because the file you create will still have the first line and so it will register as a list item. However, there are no values and so you get an empty list item and when you use a table you also get an empty table. If you convert the table to a list then it would have no items.

Link to post
Share on other sites

clear list(%test)
save to file("{$special folder("My Documents")}\\test.csv",%test)
add list to list(%test,$list from file("{$special folder("My Documents")}\\test.csv"),"Delete","Global")
remove from list(%test,0)

Remove from list

 

will take care of that item

 

Regards,

CD

Link to post
Share on other sites

Code Docta, that was just a test case. when there are actually items in the list I can't just delete the first 1

 

But you can check to see if it's blank, if that's what you're looking for?

 

Like so:

clear list(%test)
save to file("{$special folder("My Documents")}\\test.csv",%test)
add list to list(%test,$list from file("{$special folder("My Documents")}\\test.csv"),"Delete","Global")
if($comparison($trim($list item(%test,0)),"=",$nothing)) {
    then {
        remove from list(%test,0)
    }
    else {
    }
}
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...