I’m trying to make a flashcard app for a project for school. I’m just wondering how I can save what the person put in terms and definitions so that it can be inputted into flashcards.
Below is a screenshot of the design.
You can store the text input’s Text value in a variable or data source and then access it later.
If you need help, post a screenshot of the blocks you’ve tried.
I just published a flashcard app if you want to chat about it sometime. All of my terms are preloaded in the cloud but I think it would be easy enough to set up some thing like what you were doing as well. Do you plan to let users create their own personal decks?
Yeah, I’m thinking of letting users create their own personal ones.
I’ve tried creating a list and rn, I’m trying the data thing on the side.
Here’s a screenshot of the blocks (I’m not sure what to do next)
You’ll need to use List blocks to insert items into the list. If you’re brand new to Thunkable or programming in general, I recommend reading through the documentation. You can find lots of information, including tutorials and videos, by Googling [search term] Thunkable (e.g. lists Thunkable).
Lists are great for storing a series of single items. But it sounds like you want to store the term and the definition (two things). It’s possible to do this with a list of objects but it might be much simpler to just use a local data source, which is going to be similar to a Google Sheet. You can look at the “Create your own table” section of this documentation: Data Sources - Thunkable Docs.
I figured out the database thing, but when I enter the two items in the text input and click a button, it doesn’t repost it as what I entered it.
Here’s a video:
Picture of code:
The counter
variable is used as row ID
so it should not be set to 0. Set it to 1 in the Screen Opens
block and remove it from Button2 Click
.
The get value
block should be assigned directly to Label test
and Label test2
.
Both variables cards
and definition cards
are initialized as Lists
but are being used as text
. So connect the get value block direct to the
testand
test2` Labels to see it working.
Thanks, it worked. One really quick question, how do I make it so that I can update the values in the data so that it increments by one? Like when I enter my first two values, it goes up by one so that when I enter a the second value, it saves the first set of values.
Example:
I insert hi, bonjour for the first row
Then I insert another one that is bye, au revoir
And both of them save in the list.
One way of doing so is use the create row
block to add rows to your database instead of updating the same row by using update value
block.
Doing this means you need to show the rows in your database not just one single row (record variable) so you need to think what way you want to go through.
A good way is to connect your database to a DVL (Data Viewer List) so that when you add a new row you will see it in the DVL.
One last question, how can i have a button to reset all flashcards? Here’s the code I tried:
What do you mean by reset?
Do you mean to delete the records in your database? If so use the delete all rows
block.
I tried that, but when I click the button, and display the thing, it says null.
Hello, to display the flash card, you need to first check that there is actually at least one record. After deleting all rows your button to display the flash card will show null because there are no records in the database.
If you’re trying to clear the Term and Definition values for all of your data source rows then you need to use a loop and loop through all of the rows. The “row id” field takes a single number. You can’t put in a range of values (1-10).
How would I do the loop?
I tried this for the code:
That’s pretty close. You shouldn’t have a separate function (forloop) for the loop. Just put the “update value” blocks inside the “count with block”. And make sure that the count range is from 1 to the number of rows in the database, not 0 to 10. Then, use i (a variable) for the row id in the update value blocks.
If you still can’t get it, post an updated screenshot of your blocks.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.