textselectionapp-inventorlistpicker

App Inventor Listpicker, Select specific text


I need to get a specific section of text from the listpicker results. So far I can get the item I select to appear in an alert box. I need to set a specific part of that listpicker selection for mysql delete.

example: 24 - 1234567 - DTV - 25-02-2015

I need to use the '24' as this is a row id from my sql db. I can then insert this into my blocks and add to php script to delete that row.

Block Code so far for listpicker:

enter image description here

https://i.sstatic.net/NgBhw.png


Solution

  • One possibility is to create 2 lists in your Web.GotText event: list cpetypelistpicker to display in the listpicker as you already have and a second list with only the rowids, let's call that list listRowIds.

    In the for each in list loop of the Web.GotText event add additionally:

    enter image description here

    Then in the Listpicker.AfterPicking event just select the corresponding item from the second list using the Listpicker.SelectionIndex like this

    enter image description here