List View Element

Hello. Good day, please help me.

I am making a simple inventory application wherein I will be storing the Product Name, price and stock of it. Once I added it on the list, I want to view on on the ListView. But I have some error:

This is my block:

And this is what my system look likes:

I want the list view to make look like this:

Matcha 35 4 or Matcha, 35, 4
Red Velvet 45 3

Like the products should be listed

What should i fix?

Hello,

you are creating three different lists and then adding the whole three lists to other new list "prodList". You need to create a list of product where each element be a list of three items (name, price and stock). Something like this:

or a list where each element is a string with the three concepts, separated by commas:

1 Like

I'll try this. Thank you so much!

omg, it works! Thank you! I'll just try to find where I can remove the '( )' on the ListView. Thank you so much for your help!

If you try the second option, you will not have the parenthesis...and you can change the commas by blanks or whatever.

I have more question, sorry for bothering you >< I used TinyDB as storage for it. Then I input some data on the list, then I try to go to another screen. When I go back to the inventory screen, all I input data is gone. Why is that so?

In the listView? you need, in the Initialize block, to read from tinyDB the stored data and, if not empty, show it in the listView if you want to show it when starting the screen.

1 Like

Hello once again! How about this. I have update button and it works. t just that when I pick something from the ListView, it will display on their respective text boxes but it is not updated.

For example this:

I have a list for the oat, and originally it is 6 in stocks. I changed it to 9. The List view updated but when I selected, it does not match with what is shown in the text boxes after picking

Blocks

You have the list prodList where you are inserting the new elements to display in ListView, where you are updating the elements (with Update button) and that is the list you are storing in tinyDB.

But, in AfterPicking event you are using the three individual lists....which are not updated....maybe those three list are not necessary?

You can take the three elements from the Selection:

It shows this error:

Two things about this:

the first one, check the error (red cross) what it is saying.

The second one is that if you are storing, and expecting a list the valueIfTagNotThere must be a list (create empty list).

Anyway, make sure to clean tinyDb between tests until you have it fine.

Earlier, the adding the products is already working and I can put any text I want as I seud the "join", hence I also put a ", ₱"

But I have a problem now, wherein after picking from ListView, the Peso sign is also included on the text box since I select the list item get element to index 2

I tried using join function at split text at and also tries split text on index 2 but it did not work, how can we fix it?

Output:

I do not want to include the peso sign since I put myself on the feet of user, if I did not remember to remove it, the updated element will result to have two peso sign

₱₱ < like this

Use the "replace" block. To replace the Peso sign by nothing (empty string, not blank).

Thank you very much for your kind help! I am just a student and also my first time using this so I can say that I really still do not know how to work the blocks out. Thank you once again!!

1 Like

Hello, I am here again! I have a question. How can we do it where if there is an unanswered field, there will be a error message beside that field and it will not continue to do the action, it will just stop the user.

For example, I didn't put a value on the price, if I click the add button, it will show the error, making the user force to put data on it.

This is what I tried to do but it does not work.

You need to add an if/then/else if ladder testing every input field for errors before allowing the update.

For every error, call a Notifier to complain.

I have something to clarify. I did try to do what you said, and it works if I did not put on the Price Field or Stock Field:

No Price Field:

No Stock Field:

But if I just input on Name, yes it does not add on the list but the error message only works on 1 field:

This is my blocks, how can we fix it?:

You see the repeating pattern here?

That calls for a list of textbox components and matching error label components.

I have a sample in stock, but will not have access to it until later today.

Also see

https://community.appinventor.mit.edu/t/error-message-bug/115594/2