Your error says, your index is not a number instead you have added game2… try to use segment block or replace block…
Use if else if
condition instead of 3 if then
and check the Cardgame
condition before Card
.
Like this
You should check your CardView.Click block closely once.
The error is occurring because the clicked card’s id is Cardgame2
. This id contains Card
and Cardgame
both so both condition is invokable but the Card
condition invoked before Cardgame
as it is placed first. That’s why it only replaces the Card
from the id and instead of index you get game2
that is an invalid index and the error occurs. In above blocks, Cardgame
condition is placed first so the Cardgame
could be replaced from the id and other two condition would not invoke as it is in else if
.
I tried your way and the error still occurs
You won’t need to change id on schema. Your block seems right but as I said check the cardgame
condition before condition.
And even if I don’t set the click condition on the id “cardgame” it still shows the above error
It would be easier to add a temporary label and when any cardview click set text to get component id. That way you will know exactly what you get when you press a cardview and modify your code according to your needs. Use Do it to debug your blocks
Yes, this is the best way to detect actually what are you getting upon clicking the three cardview. There by you can adjust the further blocks. Simple. Also if possible try to use individual if then block instead of using elseif
I hope this will be your issue. Since both have common word card, but both will give the number only.(it will trigger card only always even though the clicked card view contain card game) So it won’t be the problem. After getting index make sure it is exactly picking the correct item from the list … use label to confirm then use open another screen block
thanks everyone
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.