Filter and connect to a specific Bluetooth device from the List Viewer

Hello Thunkable community,
I am working on a BLE app where the App first scans for all the discoverable devices and then user connects to a specific device from the ListViewer. The block implementation to discover the BLE devices is shown below:

On the App side, this is how the BLE devices are displayed for user selection:

So far so good. However to make user experience better, I would like to filter the devices and only display device with specific names only, preferably filtering a prefix, rather than user scrolling and looking for a specific device in the long list.

For instance, using the list above, scan all the devices, however, only display devices starting with prefix “MFLD_” and “DEVID_”.

Is it possible to do such filtering using blocks in Thunkable and I would appreciate if someone could provide the block snippet as to how to achieve this.

Thanks in advance. Cheers!

@ioannis, maybe you can shed some light on this one? I really need some assistance here!

Thanks

Hello @thunkable28
Yes, it is possible to filter the data you show on the list view
You will need to add a condition before you insert a device into the list
To create the condition you could use the “does string contains” block

Thanks alot, @ioannis,
Just wanted to share with the community how I made filtering work with the List Viewer block and the “does string contains” block.

Now I only see the devices I want to in the List Viewer which is awesome.
Hopefully, others will find this resourceful.

Cheers

2 Likes