How can i update a single record from google sheets with a switch?

Hi, i've been making an app that uses google sheets as a database. Its going great and i just need to make a switch that changes the text/value from a cell from "No" to "Yes" both ways (Yes to No). I know some methods with the list blocks that show the values in the app, but how can i update them and make sure the app knows which specific record to update? (ideally, with the ID to the right.)
here's an example of what im trying to do (there's info in the other cells)

Welcome Dass :wink:

You will find your answer here (update procedure)

Hi!, i'll try just that, i just need to copy the "update" part of the script and the blocks associated with it and it should work right?
like: switch=on if ID=1 update "activo" to yes and if i turn it off should do the same right?
this won't collide with other ID's right? as in, just modifies that single cell that corresponds to that ID without giving the user the ability to update other cells that correspond to different IDs right?

1 Like

Yes, that is the general idea. The script uses the record index and tests the first item. You may want to change this to test your ID number.

You may also get some ideas from here:

Hello, I am new to this forum, I looked through a lot of tutorials, I like the TIMAI2 work the most, but I have a question if it is possible to update via the selection list.

If you have a look at my CRUDII guide, this shows how you can update an item in a google sheet from the index of the list in your AI2 app

1 Like

I looked as I wrote, I like the work, but when updating it shows the entire row and I need the last three columns from the selection list.

If you only want to edit specific cells, you will need more blocks in your app and more code in the google apps script to handle that. The method I show does indeed display the entire row and update the entire row. You do not necessarily have to display all the data in your app for editing....

Editing the entire poem doesn't bother me, it's extra. Ok, I will keep trying.

Hello again, I simplified your blocks only to the update option, i.e. btViewData starts the update but I can't cope with converting textbox10 to the value from the dropdown list. I had so many ideas that I'm already stupid.

It is not obvious from your screenshots what you are trying to achieve. Where is textbox10 ?

Show the blocks that relate to your screenshots, and annotate what must change to what.

this is your google sheet CRUDQ II textbox list

I am trying to replace the last item in the pick list and all the rest will be done by the self timer

If I understand correctly, you want to replace the value Oczekuje (in textbox10) with one of the three items shown in the list on the right Wybierz, Zamkniete, Otwarte ?

If so, use the AfterPicking event of your listview/listpicker to set the value of textbox10 with the selection

yes, I tried but changes in the sheet appeared after selecting the same option twice, I will try, maybe I made a mistake somewhere

I do not know how to thank you. Fresh look and a professional look. And I've already figured out trying to replace entire lists.

My mistake I had a pick list and a drop down list in the app. Thanks again, if I could, I would give you a hug

I'll get a surrogate hug from someone here :wink:

Please to hear you got it working!

1 Like

It is a different topic, but it is about the same project. Do I need to get another selection index after filtering the data.

I will add that it sorts well, but after the update it selects the shifted lines

Yes, if you use the built-in filter on a listview, a selection will return the index of the filtered items, not the original index (it is annoying!) You can overcome this by writing your own filter with a textbox and Taifun's textbox extension.

1 Like