2014년 12월 7일 일요일

ListPicker selection is not CSV


I wrote an app to print and email receipts at community events.  Works great.  However, since most people are return customers, I am trying to allow the user to first search existing records to avoid re-entering customer data.   I have stored customer info in a CSV file on each Android device.  I use a listpicker to read the CSV using the Filter bar.  The user types a few characters of a name and selects the correct name from the dwindling list.  So far, good, except the return format is like this:  (Smith John Middletown MD joe@email.com), including the parentheses but no commas. (See the screen pics)  I want to put these fields into labels: FName, LName, City, State, Email so that I can use it in the receipt.  At this point, I am stumped.  How to get the ListPicker selection into the appropriate labels.

Screen shot of results of debugging with Do It.  The error messages are:  “Error from Companion: Select list item:  Attempt to get item number 2 from a list of length 1:  ((Smith Joe Anytown VA  Joe@email.com))

Screen shot after “Find Person” button was pressed and a person was selected from the list. 

--
your listpicker.selection is already a list
just remove the list from csv row blocks and it should work
btw. if you want to listpicker to look a little bit nicer, see the prepareListpicker procedure https://puravidaapps.com/fusionDB.php#selecthere 

--
That doesn't work!  That's the obvious solution but when I remove the "list from csv row" block, the system won't let me connect the "PersonListPicker.Selection" block into the "list" slot in the "select list item" block.  It keeps getting rejected.  It therefore seems that the "PersonListPicker.Selection" block is not a list but just a bunch of text. This boggles my mind.  I think there is something simple that I am overlooking. 

Thanks for your help.  I need to get this working ASAP.

--
Unfortunately, the text representation of a list returned by DoIt can be ambiguous.
Temporarily inserting a length() or an IsAList block and running DoIt on the result can help show what's going on.

--

댓글 없음:

댓글 쓰기