Forums > MaxMSP

Dict and Append

May 13, 2014 | 7:09 am

Hello,

I have the need to send a series of values into a dict and I would like to be able to append to existing values for any key. As it turns out, the "append newkey $1" method works perfectly for a "top-level" key, whether it already exists or not (that is, you can also create nonexistent keys using the append message). However, it seems that dict does not allow you to use the very same approach to append nested keys with new values. So, "append newkey::newsubkey $1" will just return an error. Now, you can create nested keys using the "replace" message, but even after doing so, I can still not use the append message to add new values to that subkey.

If anyone has advice on how to append to existing key data when that key is nested, I would greatly appreciate it.

Thanks,

Paul

Here’s a quick patch to demonstrate:

– Pasted Max Patch, click to expand. –

(edited by admin – pasted patcher as compressed)


May 13, 2014 | 9:01 pm

Hi Paul,

I can see this here and we will take a closer look. In the meantime, you will need to use the ‘get’ message and then append the new data to the key’s current value.

-Ben


May 13, 2014 | 11:50 pm

Thanks Ben,

I’m now using the workaround you suggested, using the ‘get’ message followed by an ‘append’ with the first new value and iterating through that in order to refresh those nested key values. It is OK for now, though it would be awesome to have ‘append’ functionality throughout various levels of the dict structure.

Also, thanks for fixing my giant paste.

Paul


Viewing 3 posts - 1 through 3 (of 3 total)