[VEX] How to setdetailattrib() to a dictionary?

   2726   1   1
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
I need to build a detail dictionary with key/values from point attributes.

Ideally something like this in a point wrangle would work:
setdetailattrib(0, d@mydict[itoa(@ptnum)], myvalue, "append");
The offender is the second argument of course, as it is expecting a string.
Edited by Andr - Dec. 8, 2020 07:30:01
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
So I managed to do it from a detail wrangle with a for-loop.
My only question: is there a more direct way to assign the key values without using the intermediate dummy array?

for(int i=0; i<@numpt; i++)
{
    string key = point(0, "key", i);
    int dummy[] = d@mydict[key];
    append(dummy, i);
    d@mydict[key] = dummy;
}

Attachments:
point att to dict.JPG (96.4 KB)

  • Quick Links