Return a list/array of specific nodes

Is it possible to return a list of nodes of a specific category or a specific figure (or even better a user defined type)?

As an example given the following:


  "nodeDataArray": [ 
{"category":"Comment", "loc":"329 -1", "text":"Kookie Brittle", "key":-13},
{"key":-1, "category":"Start", "loc":"175 0", "text":"Start"},
{"key":0, "loc":"0 90", "text":"S0"},
{"key":1, "loc":"175 100", "text":"S1"},
{"key":2, "loc":"175 190", "text":"S2"},
{"key":3, "loc":"175 270", "text":"D3", "figure":"Diamond"},
{"key":4, "loc":"79 405", "text":"S4"},
{"key":6, "loc":"289 394", "text":"D4", "figure":"Diamond"},
{"key":7, "loc":"175.5 461", "text":"YN_D4", "category":"Answer"},
{"key":8, "loc":"175 570", "text":"S8"},
{"key":-2, "category":"End", "loc":"175 640", "text":"End"},
{"key":-3, "text":"D1", "figure":"Diamond", "category":"Choice", "loc":"341 106"},
{"text":"Y_D1", "category":"Answer", "key":-14, "loc":"254.5 151", "focusMe":"center"}, 
{"text":"N_D1", "category":"Answer", "key":-15, "loc":"418 168", "focusMe":"top"}, 
{"text":"N_D3", "category":"Answer", "key":-16, "loc":"271.5 303"},
{"text":"Y_D3", "category":"Answer", "key":-17, "loc":"77 308"},
{"category":"Comment", "text":"Hide me \nwith S2", "figure":"RoundedRectangle", "key":-6, "loc":"105 174", "showWith":"2"} 
 ],

Other than performing a

<span ="Apple-tab-span" style="white-space:pre">		</span>var nodes = myDiagram.nodes;
<span ="Apple-tab-span" style="line-height: 1.4; white-space: pre;">		</span><span style="line-height: 1.4;">while (nodes.next()) {</span>
  • is it there a method to return only
  • all nodes that contain a category attribute or specifically category == X
  • all nodes that contain a figure attribute or specifically figure == Y
  • all nodes that contain a showWith attribute or specifically showWith == integerZ

Thanks for any advice

No, there’s no short-cut for any of those particular kinds of queries.

Thanks Walter. I just use a generic function within my JS then - just wanted to check I’d not missed something.

Thanks