I am trying to access the custom property doctype which is of enum type Document Type created in Cameo. I wish to access all doctype properties of all the blocks in the diagram. Note that my overall goal is to have multiple lists of documents (blocks) sorted by which doctype the blocks are, from a diagram of all of the blocks.
Here is my current code:
#set($diagramElements=$report.getDiagramElements($docDiagram))
#set($blocks=$report.filterElement($diagramElements,[“Block”]))
#foreach($b in $blocks)
$b.doctype
#end#end
Currently I am getting the error “No such property: type of block on mr.doctype”. My theory is that it’s because I am looping through blocks and blocks don’t necessarily have the property doctype. However, even if I do something like adding
#if($b.hasDoctype())$b.doctype
does not work- it no longer creates an error but the section is blank. I am open to changing the model or code, but I’m not sure how to go about it. I have double checked the model- there is currently only one block in the diagram which has the doctype property. I can access generic data like $b.name or $b.documentation fine so it’s not an issue of not being able to access the block.
I also tried $b.getExpandoBridge().getAttribute(“doctype”) from here
I attempted to find the available properties using the ClassTool mentioned here but I got an error “Syntax error: encountered “ClassTool” on line 16.” Using this code:
#set($void = $context.put('class', new ClassTool()))
$b.getFields()
I don’t think that’s right but given that I am not intending to actually use the tool and I’m not even sure if it’ll help me, I have not investigated as much.