How can I remove data from a spreadsheet after appear on screen?

Hey!

When the screen opens for the first time, a integer is selected from 1 to 52. This integer correspond to the row id that I want to pick the information on spreadsheet.

The spreadsheet contains information about a deck of cards such name, image and rule (each card has a rule because I’m doing a game).

On screen appears the name of the card, the image and the rule of the picked card through the randomly chosen integer.

After that, I can click the button “Ask for a new card”, and another integer is chosen and another card information appears on screen.

I want that the card that appeared first is removed so that no cards are repeated. After 52 plays, which correspond to deck size, the game end. When I back to menu and play again, all cards are available.

I have this code, but I don’t know how to “remove” the cards that already appeared.

Hope you can help me!

Quick Example:

By setting the list of row ids to a variable allows you to remove the row id of that card without altering your table. Then choose a random integer from 1 to the length of that list of ids. The list will get smaller as we remove them so make sure you use the length of block. Retrieve your card by using the Random Card Row Number as your row ID that you got and removed from the list. When the game ends reset the Row ID List variable with the list of values block from your table. Also make sure there are no blank rows in your table.

This is a quick example that you might have to tweak yourself

1 Like

Thank you for your answer.

I tried to adapt your blocks to my design, and I thought it will work, but when I preview de app, the screen doesn’t appear. I press the name of the screen, and nothing shows up, but when I click the others screens, they appear.

I think something is wrong with the code, but I can’t figure it out.


In the database blocks, make sure the last field is set to ID. You have it set to carta. Also, are those values stored as objects in your table? Let me have a peek at your table.

The link for my data is: Spreadsheet

I’m not sure about which column of my spreadsheet should I set as ID column.

The drop down menu should contain the names of your headers along with an ID option. After looking at your spreadsheet you only need to use the “get value” Block. Erase those property blocks and replace those “get row object blocks” with the “get value block”

Get the values like this.

One last thing, remove all blank rows in your table as they will be counted in the list of row ids

I didn’t put all images links on spreadsheet because they weren’t working, and I was trying different links until the moment the pictures appear in screen. I believe the problem is solved with cloudinary utilization.

But I have one doubt, when I import data from spreadsheet, one empty row is added at the end, how can I remove this row?

I did what you recommend, but when I click in preview button (selected in attached image) the screen appear like a flash and disappear right away and I can’t see it again.

I just tried this and it works for me.

https://x.thunkable.com/copy/f214486625665ac7dc7db19422f7467c

Actually do this instead as it will load each card faster.

Sample Project:
https://x.thunkable.com/copy/0d752500a0173ab81f3c97553052463d

That last row will always be empty and visible when you looking at it in the thunkable app. Don’t worry about that last row. Just make sure your google sheet has no extra rows.

1 Like

Thank you so much! The app is already working!

1 Like

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