How do I pull data that is within a range?
For example: the user registered thread: M5, pitch: 0.75, min diameter: 4.87, max diameter 5.00.
When he searches, he will inform a diameter, for example: 4.90, and will have to return what was registered that fits within the range of 4.87 and 5.00.
but, the user will register these values on the "registration" screen and they will be stored in tinydb, and the search by diameter will use tinydb for consultation.
explain a part of the programming which is the search, the user will register and store in the tinydb and the search will want to read what is in the tinydb
Store items to the list, then store the list in the tinydb.
Get the list back from the tinydb, and do the search.
I'm sending you the aia file so you can understand how I did it
ROSCA_METRICA3_Screen_pontoDeControle3_Screen_pontoDeControle4_Screen_pontoDeControle2.aia (34.0 KB)
I don't know how to search for a diameter that is within the Min Diameter. and Max diameter. that were registered, I know how to create a search for a label like this one, I don't know how I do this part of the logic
You need to make clear a design decision about how you are storing your parts data base in TinyDB:
Are they
- all stored together as a multi-row table under a single tag like 'PARTS', or are they
- stored separately, one part per tag, based on some unique attribute?
That's what I was doing, than this all works. but I need it to return the values that were registered based on a diameter that the user will enter.
how is it working now
when clicking on store to store tinydb
I want it when he puts a value between 4.85 and 4.90. what return what was registered, which in this case was
Do the min/max values overlap among different parts?
That would return more than one part, requiring a multipart display.
Since you are using the thread as the TinyDb tag, a width search will most likely return different parts with different threads.
An easy way to display all those rows returned from scanning all of your TinyDB would to be a List Picker or ListView with YAML Elements, one Element per discovered part.
I also see probable bug in this block:
Under tag M5, you are storing a single row table with just one type of M5 bolt?
The If List Empty test enforces having just one row in that table.
But in your SEARCH button, you assume there will be a simple list of 5 attributes in any tag/value in TinyDB.
So which is it, many M5 part types, or just one?
I did some more bolt research, and found
So I expect multiple returns from a search based on width, because length and materials and head styles can vary.
There is a TinyDB block that can return a dictionary of all the tags and values in a TinyDB instance (NameSpace).
Looping through the values is easy using the values dictionary block.
See here for advanced filtering blocks, once you get your table structure right:
https://ai2-appinventor-mit-edu.ezproxy.canberra.edu.au/reference/concepts/pholo.html
it will just be an M5,M6,M8,M10.... the values that were presented are just the tests that were running, in order to validate the programming that I had done, so you can disregard the values in the images
in the example you provided " See here for advanced filtering blocks, once you get your table structure right:
[Functional List Operators ]"
Is it possible to search by height and return the information in the other columns?
in this case it would have to return all kerry information
You still haven't settled on the shape of a TinyDB entry.
Which is it,
- A list of 5 attributes of the part mentioned in the tag, or
- a list of rows, like in your Save button?
yes one line
In that case, here is how you store a part:
This is how to store a part:
This assumes just one part per part name.
If you want to search by diameter, restrict the input text box to numbers only, and use a List Picker instead of a button:
This will filter the database by diameter:
This will display the selected part (if any).
The source:
ROSCA_METRICA3_Screen_pontoDeControle3_Screen_pontoDeControle4_Screen_pontoDeControle2.aia (34.7 KB)
It looks like a List Picker opened to an empty Elements list.
Track the Elements backwards.
how I do it?
Connect to the Companion.
Start applying Do It to the blocks in the List Picker Before Picking event, starting from that TinyDB1.GetEntries block and working your way to the left.
Show us screen shots of everything you find along the way, stretching bubbles to make it all readable.
where do I think this is what you are talking about?
I'm still getting familiar with MIT App Inventor