0

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.stack.imgur.com/NgBhw.png

Taifun
  • 6,165
  • 17
  • 60
  • 188
Fil
  • 65
  • 1
  • 11
  • Unfortunately as new user at stackoverflow you are not allowed to insert a screenshot. Sorry, I do not like to click onto unknown webpages to take a look at it. You could upload it to imgur.com or post in the [App Inventor forum](https://groups.google.com/forum/#!forum/mitappinventortest) instead... PS: I don't know, why someone downvoted your post... – Taifun Feb 28 '15 at 22:29
  • Amended web link.Thankyou for the advice. – Fil Feb 28 '15 at 22:46

1 Answers1

0

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

Taifun
  • 6,165
  • 17
  • 60
  • 188
  • Runtime Error The operation select list item cannot accept the arguments: *empty-string* 1 This is empty as i set initialize global rowid to a blank text box – Fil Feb 28 '15 at 23:03
  • Did you forget to create the second list and **to add the rowids in the Web.GotText event**? Please edit your question and add an updated screenshot. – Taifun Feb 28 '15 at 23:05
  • @ Taifun http://imgur.com/1fV708W If i dont delete the items from the listpicker it works perfectly. If i delete an item It seems to have a strange anomally. The first item i select shows the correct rowid and will delete it fine. However when i select another item from the list it seems to mess up the rowid! i then get the following message `Cannot parse text argument to "list from csv table" as a CSV-formatted table` – Fil Mar 01 '15 at 20:57
  • You have to keep you lists synchronized. If you delete an item from list1, you also have to delete the corresponding item in list2 – Taifun Mar 01 '15 at 22:12
  • How do you suggest i do that please? i do not understand what or how i need to do this. – Fil Mar 04 '15 at 20:19
  • please ask a new question and add a screenshot of your relevant blocks – Taifun Mar 04 '15 at 23:33
  • http://imgur.com/gallery/671o6v8/new You suggested i have to keep my lists synchronized. When i delete the item from list one how do i ensure that list two is also deleted. Deleteing from list one removes it from my DB without any problems. When i then request the listpicker again it shows me the items in my DB, when i delete another item the rowid is incorrect. – Fil Mar 07 '15 at 21:08
  • to ask a new question, please use the [Ask question](http://stackoverflow.com/questions/ask) button – Taifun Mar 07 '15 at 21:31
  • Its allpart of the same problem you have helped with. Do you want me to ask a new question but then have to explain all this again? Im getting abit confused as to wether your trying to help me out with my problem or just be awkward! Its all realted to the main question – Fil Mar 07 '15 at 21:39