Does this code work?

Does this code work?

No, for two reasons:

  • When you do a global init of a variable to a component's .Text value, all you might get is the value you had set in the Designer, if at all. The global init happens only once at screen load time, and does NOT serve as a rule that must be enforced every time you refer to the value of that variable. It is up to you to add the SET GLOBAL VARIABLE VALUE = (whatever) blocks to update the global variable when you have new data for it.
  • You never updated the global variable price_children, so what is the point of storing it in TinyDB?

What's the solution of making this code work?

Here is some required reading for you:
http://www.appinventor.org/bookChapters/chapter16.pdf

Be sure to read all the way through the chapter.


Would this work in screen 3

It looks reasonable.

Try it.

But ask yourself, if all you are using for a tag is the word 'price', how would you answer the question 'price of WHAT?' in Screen3?

You would need more tags and Labels.

why r u trying 2 sell children?

It's price for children, not price of children.

what??

variables names I rejected:

  • price_per_pound_of_children

what works best:

  • price_to_children