Start a new topic

Dynamic columns in tables and grids

Create columns Dynamically

  • In Tables and Grids it is possible to create Columns dynamically based on the data in SystemWeaver. 
  • To describe how this works we have set up a simplified scenario 
  • Consider the following: I want to see what functionality that is planned for which milestone

Example Meta model

image

This is the result we want

image


This is the definition

image


The report in plaintext

 

<Grid>
  <Columns>
    <ItemNameColumn caption="Function" width="200"/>
    <!--Columns can be defined based on data in the models. This is performed just like normal data collection.-->    
    <ForEachPart type="MILS">
        <DefObj>                                              
            <!--For every Milestone, create a column. Set the property objectName to its name to be able to reference it later.-->
            <!--If we get a hit, "X" will be written in that column.-->            
            <TextColumn caption="#{Name}" objectName="#{Name}" width="200">X</TextColumn>
        </DefObj>
    </ForEachPart>    
  </Columns>
  <!--Create a context for the scenario-->
  <Context name="milestonePlanning">
    <AddParts owner="main" sid="PTUR" part="functionRequirementsPart" defobj="functionRequirements"/>
    <AddParts owner="functionRequirements" sid="IURQ" part="functionPart" defobj="function"/>
    <AddParts owner="main" sid="MILS" part="milestonePart" defobj="milestone"/>        
    <AddParts owner="milestone" sid="EFUN" part="plannedFunctionalityPart" defobj="function"/>
  </Context>           
  
  <ForEachInContext name="milestonePlanning" group="function">  
    <Row>                                                     
    <!--For every found function, print a row.-->   
        <ContextGoBack part="plannedFunctionalityPart">
        <!--If it is planned for a milestone. Set a RowObject with the Milestone's name to get an "X" in the Milestone column.-->      
            <RowObject name="#{Name}"/>
        </ContextGoBack>
    </Row>  
  </ForEachInContext>  
</Grid>

 

Login to post a comment