Select list item error

I have a global variable named “user response” which creates an empty list for MCQ quiz, when user select any option, it is stored to user response list.

There are 5 mcq Questions.

When user solve 5 questions and see his responses then it is called from that list.

When user solve only 2 questions and when called user response list, then there are only 2 responses in that list and 3 are empty strings.

This create an error of select list item of index 2.

I want to add a text “Skipped” in place of empty string.

How to do this?

In your blocks, you should return a list but not the string "Skipped
you may do it in this way
"blocks

1 Like

Ok, if i return a list then, this will replace all items of user response list.

I want to only replace empty strings

is this ok?
That’s actually what you want.
Put this in the join block

1 Like

Wait i will try it first.

Still getting error

Actually your method works when whole list is empty but not when there are 2 items in the list and i am trying to get 5 items.

Obviously this creates this error thats why i want remaining 3 items as “skipped”

1 Like

That’s great.

Why don’t you add the item “Skipped” when there is not 5 items in your list?
Btw, are you using for each item in list or for each number for your dynamic label?
If so, you may want to do it in this way
blocks (1)

1 Like

I have tried this before calling list but not working.

1 Like

Here is the problem.
You set if statement to if the list is empty. But very obviously your list isn’t empty, so it won’t be exacute even there isn’t 5 items, only works when there is nothing in the list.

Therefore,
Set the if slot to if length of the list < 5
blocks (2)

1 Like

Exactly as you explained i got noticed before your reply, and same thing i did myself in blocks and its worked.

Then i saw your reply, Oh my god! Same blocks! :joy::sweat_smile:

But i really appreciate your help and quick response.

1 Like

LoL :joy:

Happy to help :wink:

Edit: Thank you for all the likes as well :laughing:
image

1 Like

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