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
This is the result we
want
This is the definition
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>
SystemWeaver
Create columns Dynamically
Example Meta model
This is the result we want
This is the definition
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>