Sorted/Ordered list problem

Hi Thunkers,

I have a list of 20 variables. I removed variables which are value zero and then ordered the list so that the highest valued variable goes to the top (index 1) and the lowest to the bottom (#).

I have tested this by displaying variable values in labels, and that works fine. My problem is that I not only want the variables’ values but also their variable names. After the sorting/ordering/removing this seems hard to keep track of for me. It is for quiz feedback. I want user to see their most commonly made mistake at the top of the list in an image and then inform the user of the number of times the mistake was made.

So, from a sorted list, can I read off both the number value of the variable at the top/second/third etc and also the name of the variable so that the appropriate “mistake” picture can be displayed?

Is it possible with blocks to query the list: from listA get varName and get varValue? (I accept this question may strike you as bonkers but I can’t get my head round how I’m going wrong).

Thank you for reading.

Does this question mean I am trying to access the variables’ meta data and it is not available without complex coding? Please let me know if you think I’m going about this entirely wrongly and should, for example, use a DB or local storage…etc.

suppose you have 3 variables and values: A=23 B=14 C=2, you want to build a list containing [ 1023A, 1014B,1002C] using math and join. sort the list into [1002C, 1014B, 1023A], split each one at the 5 position (ie. split into number and variable name) then subtract 1000 from the number. now you can build your “goal picture”

Thanks Many…it sounds too tricky for me. I’m just starting.

You probably want to learn about storing objects in lists. What you are asking about is at least an intermediate skill I would think.

You could also organize the info in tables.

Columns could be like:

Question, answer, times seen, times answered correct, times answered incorrect.

1 Like

Thanks, Jared.
Can you point me to a good beginner level tutorial on storing in lists?

Hi @hovis70653qy,

You could check this out
image

You’ll also find an airtable example there for working eith tables

I think if you store your variables as a list of objects
It could look like this
[
{
Question: “What’s your name?”,
Answer: “Jared”,
timesSeen: 10,
timesAnsweredIncorrectly: 5
},
{
Question: “What’s your age?”,
Answer: 32,
timesSeen: 10,
timesAnsweredIncorrectly: 10
}
]

i happen to have a simple, generic, quiz maker based on airtable, which i was going to share in the share_your_apps forum but haven’t gotten all the parts together yet. if you have an android, you can download the apk (executable) from here

and see if it is useful for you.
the data is based on this simple table:

the field group is an arbitrary classification that can be used for designating a chapter, difficulty level, user, etc. and is used for selecting the kind of test at the start. the field answer1 always contains the correct answer but the app will randomize the order during execution, but it will keep score, for the session.
(edited)
i’ve added my app in the share your app forum. please check if you can use it.

1 Like

Refer to this post: