How to share SQlite data between screens?

on the other screen just send your SELECT statement to the database and get back the result there
Taifun

Thank-you for your reply. The reason I asked is although I do have the SQLite component on each of my screens, not all the data is coming through. I have 5 tables but the second screen has data for only 1, sometimes 2, tables. I’m using a clock timer in the first screen to call the second screen, but no joy.

there is only one SQlite database available for your app, which is accessible from all screens, so you should be able to access all 5 tables form everywhere.

It would really help if you provided a screenshot of your updated relevant blocks, so we can see what you are trying to do, and where the problem may be.

Taifun

1 Like

Thank-you for your reply.

Project is huge, but here are the relevant blocks:

Screenshot from 2020-10-09 10-46-44

If I disable the PressMe.Button Click and physically press the PressMe button, I get 5/5 tables in next screen. :smile:
If I use the PressMe.Button Click, I get 2/5 tables in next screen. :face_with_raised_eyebrow:
If I disable Clock2.Timer/Pressme.Button Click, and enable the openScreen in the Clock2.Timer, I get 1/5 table data in next screen. :unamused:

it seems to be, you are talking about Airtables, but not the SQlite database… is that correct?
is this an extension you are using? which one?
as already suggested, read your data in the other screen and NOT in Screen1

I’m not familiar with Airtables… Airtable works asynchronously… i.e. read the data and receive the result in a corresponding event

Taifun

I am using Kodular’s SQLite. Data is being retrieved from AirTables with no issues. Please ignore the getAirTables, the problem is as I outlined in my last post, i.e., the data is not available in the next screen unless I physically press the “PressMe” button.

I don’t see you using any SQlite block in your screenshot…
does it make sense in your case to use an online database and offline database at the same time?
what exactly prevents you from reading the data in the other screen as already suggested twice?

in the button click event there does not happen much… you are only opening the other screen… or am I missing something?

Taifun

Because I don’t want to retrieve the AirTables data every time I enter the next screen, which has buttons that is used by the user to go to the third screen many times. I want to retrieve AT data once in Screen1 and put it into the SQLite1 DB. Which is being done, IF I push the button physically. The problem, as I’ve mentioned previously, is that the data is not available in the next screen unless I push the dang button; not even if the button is clicked programmatically.

So, without pushing the button, the data does not finish being input into the SQLite1 DB before the second screen initiates.

I do not think this is an SQLite1 problem, I think this an object-oriented, asynchronous issue. I described a very similar problem on the same project and was informed using a Clock timer would fix it. It seemed to, but only for 1/5 tables. Another suggestion was to use an invisible button and programmatically “click it”. That doesn’t work much better, only 2/5 tables.

Sorry if this is beyond your usual scope…but you asked. :face_with_raised_eyebrow:

in your screenshot you do not show, how the data is received from the Airtable

unfortunately you forgot to answer this question…
I can’t see you downloading any data there…
you do not show how the data is received from the airtable…

there is no need to press a button programmatically… use a procedure to call the functionality you need and call that procedure in the button click event as well as whereever you need it

yes exactly, therefore in that event after the data is received, there you should open the other screen and not elsewhere

it always helps to stay in one thread and not open another thread with the same issue…

don’t worry about me… Airtable is only an online database… and all online databases work asynchronously, this is not a big deal, you only have to understand how asynchronous logic works…

Taifun

you might want to look again at your other thread


Taifun

EDIT: Problem is solved. After some sleep I added the openScreen to the end of my ssAll .Got Column routine. I simply added the counter check to ensure I was at the very end of the routine…duh. :drooling_face:

Screenshot from 2020-10-10 10-16-27

Which is pretty much what Taifun suggested, and it worked! :joy:
Having the next screen open after the .Got Column finishes ensures the data is inserted into the SQLite1 DB before moving forward. Did not need the clock timer or an invisible button. Those are good methods, just not what I needed for this application.

I’d like to mark the subject with [SOLVED] and credit the solution to Taifun…but I guess since I don’t own the thread, it won’t let me do that.

Anyway, Thank-you so much for your help, Taifun, it is really very much appreciated. :sunglasses:

-Kevin

Thank-you for your reply, Taifun. :smile:

I use the insertTables proc to load the data from the ssAll spreadsheet. The data is being loaded into the SQLite1 as the list lengths are all correct and the SQLite1 .Insert row count return numbers are correct…but only inside the insertTables proc…not outside that proc (same screen) where I can access it, nor in the other screens.



Multiply this image by 5 and you have my current ssAll. Got Column.

I can’t add anything to the bottom of the .Got Column as it is called 20 times, 5 tables times 4 columns. If I similarly try to open the next screen from the end of the .Got Column, it opens after the first run, then I have maybe 1 column loaded in the DB, certainly not all 5 tables. :unamused:

Opening the other screen would require having the user push a button to get to the second screen with buttons…which is the whole point; I don’t want the user to have to do that, I want the app to open on the buttons after the AT data has been loaded into the SQL1 DB in Screen1.

The second (buttons) screen could be modified to not use a third screen, except the data isn’t available in the second (buttons) screen’s SQLite1 DB either. :tired_face:

So far I’ve been given three possibilities, use a timer, use an invisible button or use a procedure. They each work somewhat, but I have been unable to get any of them to work completely as needed.:pensive:

I simply do NOT understand why my data is available in a routine run out of the .Got Column, but nowhere else in the screen! :face_with_symbols_over_mouth: And even then, if the data is loaded into SQLite1, then why is it not available in the next screen? :roll_eyes:

You are right, I still do not understand how best to kode in object-oriented asynchronous programming after using it for two years, I guess I’m not that bright. :drooling_face:

I believe the .Got Column takes too long (in cycles) to load the 5 tables of 4 columns of up to 25 rows of data into the SQLite DB; which shouldn’t be a problem, it’s all text. Am I wrong? Anything I try fires before the data is fully loaded in the SQLite DB. I’ve tried waiting .5 to 5 seconds, so that ain’t it. :unamused:

As for the other thread, it wouldn’t let me reply to it cuz I was the last poster, and I would have had to wait until someone else had replied, right? I believe this is a silly rule, but maybe there is a good reason for it. I only replied to this thread to ask the OP how they “solved” it…and you replied and we went on and on and like that. Thank-you for the housekeeping. :smile:

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