Logic blocks to enable/disable a TextToSpeech

Hello everyone,

I need help for my application because I can’t find a solution enable or disable a texttospeech (cf my blocks image)


Let me explain :
When the screen is initialized 5 listviews are filled by items from a google sheet.
Sometimes there is 5, 6, 7…items, it’s not alaways the same.
I have a clock (Clock1) which is set to call a TextToSpeech. It’s working when the time reach the item of a listview (listsecond). The TextToSpeech tell the items of two other listviews (ListDistance100 and ListDistance200).
So I created many blocks for all the potential number of items of listSecond (it’s all the IfThen blocks).
But when there are less items than I could be at the maximum (in exemple : I created 9 blocks of IfThen but this time there are only 5 items) , the application shows me an error message.

So I need a logic block which disable the Then/TextToSpeech when the number of Items is less than the number of items expected from the IfThen Block.

I hope I was clear and I appreciate your attention for my problem.

Best regards

Clément

You need to be testing a length of list, then using this to reduce the number of if/then blocks you have, along with a counter or two. You should be able to create a single if.then statement that handles all the different list lengths.

Thank you for your response, you apened my mind on an another way. I solved my problem even if there is not only one if.then ^^