Having an issue saving to list - Can't find error

Hello,

I have been working on this app to track BBQ times.

Screen1 will show time and current schedule. Nothing if a schedule isn't selected.

Schedule will show a list of schedules with options to create and edit schedules.

Edit will allow you to create a new schedule is start value is empty or load the schedule if the start value is not.

The problem I am having is that I can create the schedule name but not save item in the schedule.

For some reason it is telling me:

Error from Companion: The operation add items to list cannot accept the arguments: ,[""], [{"Text1":"20:32","Text2":"Ribs - Season","Image":"None"}]

I believe it is the additional ,[""], but I cannot seem to locate where it is coming from.

This is the code block where I am finding this error.

Hello EVGAFTW,

From your error message, it seems that Current_List is an empty string and not a list, and that's what caused the error.

We need your full code to understand why. Please right-click an empty space in the Blocks editor, select Download Blocks as Image, and upload the image here. What might help is replacing the input of initialize global Current_List to an empty list if the input is a string, but this is only an assumption.

I've actually figured this out already.

It has to do with my screen initialize.

Upon initialization, I am getting the start value from the Schedule screen (empty value if a new or no schedule is available or a start value of the selected schedule). Setting the global Selected_List to start value.

I then set the Current_List to TinyDB Tag global Selected_List with value "" if not there.

This was the problem, I changed with "Create empty list"

Nice job. Yes, a lot of people forget replacing the default valueIfTagNotThere text block, which sets the variable to a string. I've set your answer as the solution.

A lot of times, the hardest thing is to find our own mistakes ...

Well, for me currently, the hardest thing is sorting the list then displaying it in list view without the brackets and symbols. So, I'm on to that now. Thanks for the response though.

If you want to create a ListView with detail text, you must change ListViewLayout or it will not work. You might want to consider setting ListViewLayout to MainText, DetailText (Horizontal).

image

As for sorting the list, this code seems to be working.

Yea, I've got the list view working. But with brackets and such.

{Image":"None","Text1":"15:53","Brisket - Season"}

After selection, I am using Text to Speech to voice my selection (As a debugger really, not final)

I am replacing the text as such:

But when displaying that list in the list view I cannot remove the symbols.

I am using this to attempt to do that.

image

These are my blocks. Sorry for the mess. I know there are better ways to do this. But I haven't used AI2 in many years. Maybe 6+ years.

Try not to use replace all text to deal with JSON. Instead, use the dictionary blocks, which is way easier and way more convenient.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.