Present data in your model using image

Visual Paradigm’s Doc. Composer allow user output their models into HTML, PDF and MS Word documents. By create custom templates user can even control what data to be shown, and how it should be formatted. In this article we will demonstrate how to generate document by use image to present the values in your models.

Our sample model

We use ArchiMate Capability element as example and using custom tagged values to model various capability values.

Capability values show as tagged values

Capability values show as tagged values

Create the document

  1. Create a blank diagram (any type).
  2. Create Image Shape on diagram, specify the image which representing the capability value we would like to show.

    Create image shape for present the values

    Create image shape for present the values

  3. Right click on the Image Shape and select Open Specification.

    Open specification dailog of image shape

    Open specification dailog of image shape

  4. Name the Image Shape as the value it presenting (so that you can distinguish the element in future in case need to modify it).

    Name the shape as its value

    Name the shape as its value

  5. In the Description area press the Insert Image button and specify the image again (this is the one to show in document).

    Insert the image it presenting into description area

    Insert the image it presenting into description area

  6. Repeat step 2-5 for other values you would like to present.

    Repeat the steps to define images for all capability values

    Repeat the steps to define images for all capability values

  7. Go to Tools > Doc. Composer > Build Doc from Scratch.

    Build doc. from scratch

    Build doc. from scratch

  8. Select project root note in Model Explorer, then right click on any template in Template pane and select Duplicate form popup menu.

    Duplicate a template in project root level

    Duplicate a template in project root level

  9. Name the template as CapabilityValue1.

    Name the tempalte as CapabilityValue1

    Name the template as CapabilityValue1

  10. Replace the template content as below. Press OK to confirm the change.
    <?xml version="1.0" encoding="UTF-8"?>
    <ProjectBaseInitiationBlock>
      <IterationBlock modelType="ImageShape" allLevel="true">
           <Conditions>
          <ValueChecker property="name" value="1"/>
        </Conditions>
        <Property property="description"/>
      </IterationBlock>       	
    </ProjectBaseInitiationBlock>
  11. Repeat steps 7-10 to create template for different capability values.

    Repeat to create template for all capability values

    Repeat to create template for all capability values

  12. Select the container containing your capability models in Model Explorer tree. Select any template in Template pane and select Duplicate from popup menu.

    Duplicate container template

    Duplicate container template

  13. Name the template as All Capabilities.

    Name the template as All Capabilities

    Name the template as All Capabilities

  14. Replace the content of the template as below. Press OK to confirm the change.
    <?xml version="1.0" encoding="UTF-8"?>
    <ElementBaseInitiationBlock>
      
      <HasChildElementChecker>
        
      <TableBlock colWidths="20, 80" >
        <TableRow>
          <TableCell>
            <Text>Capability</Text>
          </TableCell>
          <TableCell>
            <Text>Overall Assessment</Text>
          </TableCell>
          <TableCell>
            <Text>People Assessment</Text>
          </TableCell>
          <TableCell>
            <Text>Process Assessment</Text>
          </TableCell>
          <TableCell>
            <Text>Tech Assessment</Text>
          </TableCell>
          <TableCell>
            <Text>Data Assessment</Text>
          </TableCell>
        </TableRow>
        
        <IterationBlock>
          <TableRow>
            <TableCell>
              <Property property="name"/>
            </TableCell>
            <TableCell>
              <ValueChecker property="Overall Assessment" value="1">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue1"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Overall Assessment" value="2">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue2"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Overall Assessment" value="3">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue3"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Overall Assessment" value="4">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue4"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
            </TableCell>
            <TableCell>
              <ValueChecker property="People Assessment" value="1">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue1"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="People Assessment" value="2">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue2"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="People Assessment" value="3">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue3"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="People Assessment" value="4">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue4"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>				
            </TableCell>
            <TableCell>
              <ValueChecker property="Process Assessment" value="1">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue1"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Process Assessment" value="2">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue2"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Process Assessment" value="3">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue3"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Process Assessment" value="4">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue4"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>				
            </TableCell>
            <TableCell>
              <ValueChecker property="Tech Assessment" value="1">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue1"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Tech Assessment" value="2">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue2"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Tech Assessment" value="3">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue3"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Tech Assessment" value="4">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue4"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>				
            </TableCell>
            <TableCell>
              <ValueChecker property="Data Assessment" value="1">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue1"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Data Assessment" value="2">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue2"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Data Assessment" value="3">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue3"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>
              <ValueChecker property="Data Assessment" value="4">
                <ProjectBaseInitiationBlock>
                  <Inline template="CapabilityValue4"/>						
                </ProjectBaseInitiationBlock>
              </ValueChecker>				
            </TableCell>
    
          </TableRow>
        </IterationBlock>
      </TableBlock>		
      </HasChildElementChecker>		
    </ElementBaseInitiationBlock>
  15. Drag the All Capabilities template into document editor.

Now the capability values defined in tagged values are present with images.

Capability values show as images

Capability values show as images

Explanation of the Template

The CapabilityValue Templates

The CapabilityValue templates will loop through the project to find out the image shapes. And if the name is matched to the capability value we hardcoded then it will output its description property (in this case it is an image).

<IterationBlock modelType="ImageShape" allLevel="true">
     <Conditions>
    <ValueChecker property="name" value="1"/>
  </Conditions>
  <Property property="description"/>
</IterationBlock>

The All Capabilities Template

This template will loop through all models in the selected container to output the capability values. The capability data in the model will show in a table and therefore we first create table header.

<?xml version="1.0" encoding="UTF-8"?>
<ElementBaseInitiationBlock>
  
  <!-- Children (Summary) -->
  <HasChildElementChecker>
    
  <TableBlock colWidths="20, 80" >
    <TableRow>
      <TableCell>
        <Text>Capability</Text>
      </TableCell>
      <TableCell>
        <Text>Overall Assessment</Text>
      </TableCell>
      <TableCell>
        <Text>People Assessment</Text>
      </TableCell>
      <TableCell>
        <Text>Process Assessment</Text>
      </TableCell>
      <TableCell>
        <Text>Tech Assessment</Text>
      </TableCell>
      <TableCell>
        <Text>Data Assessment</Text>
      </TableCell>
    </TableRow>

After that we iterate the model elements under the container and printout its name.

<IterationBlock>
  <TableRow>
    <TableCell>
      <Property property="name"/>
    </TableCell>

Next we evaluate the value of a named capability value (tagged value) from the mode element and determine which image to show. The image will be show by calling as inline template.

<TableCell>
  <ValueChecker property="Overall Assessment" value="1">
    <ProjectBaseInitiationBlock>
      <Inline template="CapabilityValue1"/>						
    </ProjectBaseInitiationBlock>
  </ValueChecker>
  <ValueChecker property="Overall Assessment" value="2">
    <ProjectBaseInitiationBlock>
      <Inline template="CapabilityValue2"/>						
    </ProjectBaseInitiationBlock>
  </ValueChecker>
  <ValueChecker property="Overall Assessment" value="3">
    <ProjectBaseInitiationBlock>
      <Inline template="CapabilityValue3"/>						
    </ProjectBaseInitiationBlock>
  </ValueChecker>
  <ValueChecker property="Overall Assessment" value="4">
    <ProjectBaseInitiationBlock>
      <Inline template="CapabilityValue4"/>						
    </ProjectBaseInitiationBlock>
  </ValueChecker>
</TableCell>

Repeat above for different capability values, and finally close table.

    </TableRow>
  </IterationBlock>
</TableBlock>		
</HasChildElementChecker>

Related Know-how

Related Link

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply