Need help with this code. I don’t know what’s wrong with the code. It works sort of fine. the only thing is let’s say the list is a,b,c and i select b so now it becomes speaker1 and then i select a it becomes speaker2 but the nly thing that appears is a (2),b,c and then if i select c i get a(2),b(1),c so the item i select doesnt get updated…
theres nothing else related to this code this is a seperated code and doesnt use other blocks.
Pardon me if I missed this post earlier.
I may have encountered it and my eyes glazed over when I saw the code.
It looks like you are presenting complex objects in a List Picker, and
editting the Selections.
Unfortunately, we can’t see what the data in the Elements look like or how they got there.
For cases like this, the general approach is to use the .SelectionIndex (not the .Selection!) from the List Picker to go back to the underlying global list variable, edit the corresponding item in that list, then refresh the List Picker Elements from the global variable.
P.S. Please delete your nag post from the thread of that other user. it does not belong there.
It used to be like that until I realized it doesn’t work. Let’s say someone has 5 people ordered and they remove the 3rd one. The order of the 4th and fifth will change aswell. I’ll fix the selection index.
As for the comment (sorry ) I can’t find it. I think it’s deleted? It used to be on top of mine.
EDIT: found and deleted it!
would you like a copy of the project? this side only
Okay so i saw the code from your perspective and it’s very foggy sorry for that. Here are some clarifications:
Global speakers: List of names that get selected from the list picker
Global present members: All the names in the list picker
Elements: the modified list of members in global speakers with their index and the rest of the members.
Is this what you are trying to do?
I forgot to ask …
How would you represent some one being asked to speak twice?
They can’t. If you select someone already designated to talk, they’ll be removed from the speakers list.
As for the project above it isn’t what I’m aiming for. I’m trying to keep both speakers and non speakers in the list but give speakers the order in which they speak.
Let’s work from things that I’m not seeing here …
-
A usable name for ListPicker2, representing what it is meant to present. Perhaps lpkAttendees?
-
A meaningful name for the global list elements. elements of what?
-
A ListPicker .BeforePicking event block. There are invaluable for pre-loading your .Elements after some kind of filtering or formatting (edit) operation.
-
Standard conversion formats for complex objects, for use in building up items in .Elements lists and decoding them back into their original complex objects. Think of the Csv conversion list blocks, or the Web component’s JSON conversion blocks. Whenever I see some one fiddling with ‘(’ and ‘)’ text fragments, it feels like biting into eggshell fragments in an omelette.
It means some one has not attended to object structure properly upstream.
Here is my take on the problem, without the restriction on adding attendees to the speaker list if they are already on it.
(That is easy to add.)
Selection of an attendee from the Attendees lpk automatically adds him to the end of the speakers list, but he can be removed after selection from the speakers (actually speaker order) list.
I added options to rearrange the speaker order.