How to update cells in Data Source (rowID)

I am trying to display sorted data using the Data List Viewer. I want to use the data list viewer to show the data rather than using List Viewer because I want to be able to take advantage of the display options and swipe features in the data list viewer.

I have a bunch of values stored as a list in a variable. I want to write that list into a column in a Data Source table so that it can be displayed in the data list viewer. However, I do not see how to do this. Where do I find out what the rowID is for the cells in the Data Source? Is there a way to write the data in the list to a row using a loop?

Any help gratefully received!

The click event gives the rowID of the row you are selecting.

Thanks @muneer (again!). So it seems I can’t write data directly into a specific cell of the Data Source?

1 Like

Yes you can, using the rowID you can [update] any cell.

As I understand it, you can only write data into a cell using the block that requires a click event. I want to write a list of data into a data source column but this does not seem to be possible.

1 Like

Of course it is possible. If you can explain your requirements in more details and/or provide screenshot of your blocks you will find many in the community who can help you achieve what you want.

I have a list stored in a variable. The list has been sorted according to a user preference. At the moment, that list is displayed using the List Viewer. However, it would be much better if I could transfer the list in that variable into a column in a Data Source so I could display it using the Data Viewer. My question is what blocks do I use to transfer the list from the variable into the Data Source. When I look at the Data Source blocks I do not see a way of doing it. If there is a way to do this, it would be great if you could explain or point me in the right direction. Thanks!

You will need to create a data source and have the user preferences in this data source. You can then use a block in the data source drawer called [List of values] to get all the data available in the data source. You can then assign a list variable the values in the data source.

This will load all the items in the data source into the variable list so you can use it later in your code.

I think this doing the inverse steps that I want to do. I want the app to sort a list into a variable and then transfer that list into a column in the Data Source. The list will keep changing and so the data source would need to be updated constantly. What I think you are describing is entering data into the data source first and then calling that data using a variable?

The only data block I can see where you can write data to the Data Source (rather than creating the data in a separate table beforehand) is the ‘Set Cell’ block, but that only seems to fire when there is a click event.

The reason for asking about this is to use Data Viewer instead of List Viewer to show certain data in a list. At the moment, the List Viewer shows my list variable nicely. However, it would be much better in terms of functionality if I could have the Data Viewer view the list so that the user can then swipe left/right to perform other functions. As far as I can tell, there is no way to swipe left/right on a list viewer item.

1 Like

I apologize for the misunderstanding.
I’m out now but when I go back to my computer, I’ll send you the blocks that should perform what you just described. :innocent:

1 Like

@slothball
I assumed you already have your choices in a list so you need to loop through the list to add the the contents of the list to the Local Data Source.

You might also need to use [Delete All Rows] block to clear the Local Data Source when needed.

image

Let me know if you want further explanation.

1 Like

@muneer - thank you so much for helping to explain how these blocks work. I really appreciate it! I will see if I can get this to work.

1 Like