Quiz App using google sheet via google's visualization API Query Language (instead of Data Source)

i’ve just recoded my earlier quiz app which used airtable as datasource into a new version using google sheet as source of the quiz but NOT as a data source. Instead i’m using Google’s Visualization API Query Language to read the worksheet (see this recent discussion in the forum ). It’s a different approach for working with google sheets, but i like it!

below is the contents of my worksheet. ( Note - in order to use the query language, the worksheet must first be shared such that anyone with the link can read it).

my quiz app starts with a list of tests to choose from.
image
these choices represent the distinct values of the column grp. if i had been using the worksheet as a data source i would have had to write my own drop-duplicates routine to obtain this list, but with the query language, i simply submitted this query
SELECT A, COUNT(B) GROUP BY A
and i got the result as a json string, ready to parse.

later after my app gets the grp selected by the test taker, it will set up the quiz so only the rows with the matching grp will be presented. for example if the selected grp was ‘LY’, i would submit this query to the query language processor:
SELECT * WHERE GRP=‘LY’
and ALL the rows matching the condition are returned in the json string response!


(note: the correct answer is always coded in answer1 but my app shuffles the possible answers at test taking time).

you can inspect the code to see how the queries are submitted and how the json reponses are parsed.
visit this link for the complete reference (it comes with its own urlencoder to help you formulate your query):

here’s my project link:
https://x.thunkable.com/copy/681bc20be539e1792025a7d4adeb4968

4 Likes

You nearly tricked me.

I was looking at your function runquiz and wondering how you got the special variable j to work outside of the original loop.

It took me some time to realize that it is a function parameter :rofl: :rofl:

1 Like

haha!

1 Like

This is awesome!! Thanks for posting this guys.

any thoughts on why this is crashing?

getting a please check your code and reset

I know some of you have assisted in my other posts. This seems like it could be the answer to a bypass.

within pull of JSON list.

JOIN
BLOCK1: TABLE.ROWS[
BLOCK2: (VAR) A variable that is created by comparing the user login name to the list in sheets. AKA :“2”
BLOCK3: VAR].C[14].V

Indicating from row (unique number) and Column (specified) pull value?

DIsplay in List Viewer

Wouldnt that work for specific row value?

If you do not check for the value of the green error block then your code will run whether or not the API response is received. Any time you attempt to get an invalid property from an object, it will crash your app. The exception to that is if you use the advanced version of the get property of object (by right clicking and choosing show advanced block) so that you provide a default value if the get property request fails. But I would start with the error block.

Updated. Response was received.

I added back in the count with block. Crashed.

Apparently, property issue within that

The “Length of” block caused it to crash

Data is now coming through.

Within first list filter, its only pulling first row of data in column 17. Instead of all of them.

Then, wanted to filter again of unique row ID

your last post in the forum said 'data is coming thru" - do you still have an issue? do you still get length of block error.
thanks,
manny

Data is rocking.

Length of block still causing crash

then trying to filter an exact row from unique ID from the c[17].v

i just ran my program - unchanged
Thunkable

[

Thunkable

](Thunkable)

and it runs fine.
what changes have you made? did you change the worksheet?
manny

I had multiple sheets within the spreadsheet. Being that everyone was working on 1 sheet. I condensed it.

I’ll resync

Is it possible to skip the count (i).

Really just want to go table.rows(var:userrowlookup).c(17).v

Main sheet label “Login”