sorting part of a structure

Swiftlikeninja's picture

Hello again everybody,

You all have been extremely useful thus far in assisting me in grasping quartz composer. I need some further assistance though. I have a structure with two of the indexes out of order. I only need to sort those two and not the entire structure, can anybody assist me with this.

thanks in advanced

usefuldesign.au's picture
Re: sorting part of a structure

Swiftlikeninja wrote:
I have a structure with two of the indexes out of order. I only need to sort those two and not the entire structure, can anybody assist me with this.

You sort of need to be more specific in your query. Also stating what you have tried and why it doesn't work / what error you are getting gives people an +in+ and makes them more inclined to offer some help. Alot of posters on Kineme are developers and such questions seem trivially simple to them so they tend to ignore which can make it hard on non-programmer newbs. (I'm somewhere near the newb dev, I guess).

That said, indexs seem to get out of order when assigning key/value pairs inside a Javascript iteration loop but given that you have assigned a key the objects can be referenced by the key (which is whatever you made it) and not the index so that should get you out of most problems. I think we already discussed this issue on another thread, i'l look for a reference.

usefuldesign.au's picture
Re: sorting part of a structure

This comp sorts a series of structures by item index and by object key. Use 'i' and 'j' keys to toggle the modes. Other keys to change display preferences. Is actually more complicated than your asking because we were discussing nested strucutres, ie. structures containing structures. Leaved or sequential which this comp attempts to illustrate (although still needs some explaining before you look at it!)

Then become an issue of leaving the data into structures or sequentially assigning. Consider metaphor of a photocopier that has a sorting rack whereby each next copied page can go onto the next rack (leaved) thereby put each page of first set onto a seperate rack or it can do first set of pages on first rack second set on second rack etc etc (sequential).

Anyway address this index out of order prob directly, you can examine the relevant Javascript patches. Rest is just window dressing.

PreviewAttachmentSize
nested structure (leafed:seq).qtz76.97 KB

usefuldesign.au's picture
Disordering part of a structure

This one disorders (randomizes) a structure. Not what you asked for but code is simpler to follow and may serve as an introduction to my other comp.

PreviewAttachmentSize
Random shuffle thru struct.qtz17.72 KB

Swiftlikeninja's picture
Re: Disordering part of a structure

Thanks for the replies, in the future I will try to give more detail. Until then I will dig through the provided examples and see what treasures they hold. Thanks.