Here is a fairly clean solution to the issue of checking whether an attempt to insert or update a record complies with databse uniqueness requirements, and therefore would fail if the insert was attempted. This is an alternative to attempting the insert or update and then checking to see if it failed or not, so these tests are added to the list of other field or row validation tests: Using 'EXISTS' to check for whether any other records match the selected field. For completeness, the SQL commands are like this:
SELECT EXISTS (SELECT 1 FROM context WHERE context_short = '
the 'SELECT 1' subquery only needs to select one row to demonstrate that a record already exists with the same field value, although there shouldn't really be any more than one record already existing anyway in this particular instance because we're testing for uniqueness. I hope this helps anyone else who has faced the same issue as me.
Just to point out, in this instance I'm only using visible labels as variables so I can see what the output is during development. A normal non-visible variable should work just as well.
What I have is a schema for the database, so technically there is no data in the database, can you further explain what I need to do in order to establish the my database in the mobile app?
sorry, im new in using MIT app and connecting my application to the database appears to be hard for me.
Please read the documentation linked to in the first post.
The extension will only load (open/import) a valid sqlite database file. You would need to open an empty database (an example of one is provided in this topic), then you should be able to apply a schema (not tried this).
However, I have read:
there is no notion of schema in SQLITE, at least not in the same way as in MSSQL
I just want to know about simplesqlite extension support.
I found the sql select command that use more than 1 table and using INNER JOIN to connect a table to another table could not be run with expected result.
The SQL command as follow :
SELECT postalcode.postal_code, subdistricts.subdis_name, districts.dis_name, cities.city_name, provinces.prov_name FROM postalcode INNER JOIN subdistricts ON postalcode.subdis_id = subdistricts.subdis_id AND postalcode.dis_id = subdistricts.dis_id INNER JOIN districts ON postalcode.dis_id = districts.dis_id AND postalcode.city_id = districts.city_id INNER JOIN cities ON postalcode.city_id = cities.city_id AND postalcode.prov_id = cities.prov_id INNER JOIN provinces ON postalcode.prov_id = provinces.prov_id WHERE postalcode.postal_code LIKE '13470%'
This SQL command could be well proceed on 'SQL Browser" as follow :
But it cannot be proceed as expected by app inventor using simplesqlite extension which when I run the app I got query result: ["SQL command completed"] as follow:
Hi, I extract data from sqlite with simple sqlite. I seem to get a list of lists. I can use the for each blocks (numbers or items) and they return what looks like a list, but when I check if it is a list with the "is a list? thing" block it says it ist't and it also does not allow any list operations. It is also not a string. How can I access the data?
I add screenshots from the blocks and the errors. The Bad arguments is what I get when trying a list operation on the item returned by the for each loop. The index is too large I get when trying to access the first element of the list I get as result from the sql query. The third screenshot shows the vallue returned by the sql query.
Anny Idea how to get to the values from the sqlite db?