coll help.. returning all data with same nth element

metamax's icon

I have a several colls with thousands of entries consisting of symbols stored with numerical indices. However the indices aren't just keys, but decimal values associated with the actual data... so I can't just renumber everything because I need those values to lookup related symbols. The problem is that many of the entries are indexed with the same decimal value (the original data came from other sources).

How can I fix this? I need to retrieve multiple strings of symbols using a specific value that may or may not be associated with more than one index.

Max Patch
Copy patch and select New From Clipboard in Max.

metamax's icon

Specifically, I need to recall multiple scale,chord,interval names associated with pitch class sets using a decimal number.

pdelges's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here are two ways:

metamax's icon

Patrick, thanks very much for the examples.. they give me a lot to think about. I like the simplicity of 'gated dumping'. The only issue seems to be that entries with only a single symbol are prepended with 'symbol'... whereas entries with multiple symbols are not. So if I use [route symbol] to get rid of 'symbol', it filters my other results.

I still also need to figure out a solution regarding the indexing of the coll.

Maybe I should be a bit more clear (at least for anyone else who might be willing to take a look...)

I imported a spreadsheet via space delimited txt file into a coll. It has thousands of numerically tagged entries in the form of phrases and sentences. The first problem is that there are many duplicate numerical values, so they can't be used as indices. The other problem is that I need those values to access the data. So even if I re-index everything, I still need a way to grab results based on the original numbers.

To illustrate:

After importing the spreadsheet, I ended up with something like this:

A.

15, community escalators;
22, motor boats;
28, jet planes;
32, vespa scooters;
32, harley motorcycles;
43, wooden skateboards;
51, otis elevators;
64, compact cars;
64, moving trucks;
64, luxury sedans;
86, running shoes;

Ideally, I would enter '64' and it would return "compact cars", "moving trucks" and "luxury sedans"... but the repeating index is a no no...

If I renumber the coll, it eliminates the original numerical values which is not acceptible because I need those values to grab data.

So it seems that the only option is to turn my original indices into data (which is really what they are to begin with) and get something like:

B.

1, 15 community escalators;
2, 22 motor boats;
3, 28 jet planes;
4, 32 vespa scooters;
5, 32 harley motorcycles;
6, 43 wooden skateboards;
7, 51 otis elevators;
8, 64 compact cars;
9, 64 moving trucks;
10, 64 luxury sedans;
11, 86 running shoes;

The problem here is how do I call to the first element of each indexed entry - not the index itself - and return the rest of the symbols for that entry... as well as all of the other indices that have the same first element...?

A second coll to translate entered values to index numbers fails because that would require me to use the same repeating values as indices:

C.

15, 1;
22, 2;
28, 3;
32, 4;
32, 5;
43, 6;
51, 7;
64, 8;
64, 9;
64, 10;
86, 11;

So perhaps I need to set up a second coll such as:

D.

15, 1;
22, 2;
28, 3;
32, 4 5;
43, 6;
51, 7;
64, 8 9 10;
86, 11;

Then if I enter '64' it returns the list 8 9 10.. but aside from figuring out an efficient way to translate coll B. to coll D... (not sure how I would even approach that), I don't know of an object that takes a list of variable length and sends out each element in order. Either way, I think that's what I need.

broc's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here is Patrick's solution adapted to the format of coll B.

metamax's icon

broc.. that helps. Though I still need to figure out how to deal with the output. Everything shows up perfectly in the print window but grabbing the lists directly from the gate outlet is another story. I may end up reformatting the original data so I don't have to mess with it. Thanks for the input.