Coll and Dict embed issues

Jan 31, 2012 at 7:21am

Coll and Dict embed issues

I’m running into some problems saving data in my patch using coll and dict. I’ve tried setting embed to 1, importing and exporting from files, etc. but it’s always the same problem. The data is saved just fine, but when I try to modify it, (say by setting a value in dict) all the data is cleared and all that’s left is the new data I sent in. Has anyone experienced a similar problem, or would anyone know how to help?

-John Cassidy

#61550
Jan 31, 2012 at 9:54am

An example patch would help, otherwise its only possible to guess why things aren’t turning out as you’d like.

My guess, from what you say, is that you are (unintentionally) overwriting the content(s) in dict rater than creating a new key value pair or appending data to the existing key…

#222142
Jan 31, 2012 at 8:23pm

I’ve attached a zip folder containing my example patch and the files needed to run it. I actually solved the coll issue in the process of writing the patch, but am still stumped on dict.

Also, when the contents of a dict object are deleted in the dictionary editor, and you send in another key to add, all of the previous contents reappear alongside the new key. You can only truly get rid of keys using the dict.strip object (and, apparently, reopening and modifying a dictionary). Related to the previous problem? Perhaps..

#222143
Jan 31, 2012 at 8:27pm

By the way, for those of you who are interested, there is a full explanation of the coll embed problem described above and its solution in the example patch. Basically, you can’t have values stored under the same key and have them recalled properly when the patch is reopened.

#222144
Feb 1, 2012 at 11:35am

Hmm… There’s something going on in your patch that I haven’t been able to isolate yet (to make things worse I’m not all over the dict family yet so maybe I won’t be the best help). The thing is, with a really simple example of embedding dict data, then saving and reloading and adding new entries, dict works as expected…

– Pasted Max Patch, click to expand. –
#222145
Feb 1, 2012 at 5:42pm

The main difference I can think of is that I’m storing dictionaries, not numerical or symbol values. Maybe in order for a dictionary to properly recall all of the subdictionary objects under it, each subdictionary needs to be embedded in the patch as well in its own dedicated dict object. I tried just setting the embed attribute for the unnamed dict object in the patch to 1, but that didn’t work, I’m assuming because when you change the name of the dictionary, the other dictionaries cease to be stored anywhere. In create a dedicated embedded dict object for an indeterminate number of subdictionaries, some patcher scripting in javascript would likely be required. I may try this last hypothesis in a bit.

#222146

You must be logged in to reply to this topic.