Using the SystemWeaver Script Language, you can configure a change log of all items that are subject to change control and include this in a report or document.  This article provides simple change log configuration examples.


Example Data 

Version 2 of the "Function Requirements" structure has been released.


A new version (version 3) has been created. In version 3, "Manual Washer Wiper" has been removed. "Maintain cruise speed" and "Startup under warm conditions" have been updated, and "Seat ventilation" has been added. 


Examples Using ForEachItemInChangeLog

Example Configuration

Standing on "Requirement Section" in above structure example. 

<Report> 

    <ForEach select="/REQS"> 
        <AddToChangeLog/>
    </ForEach>

    <Section title="Change Log - updated items"> 
        <ForEachItemInChangeLog type="updated">
            <Text>#{Name} </Text> 
        </ForEachItemInChangeLog>  
    </Section> 

    <Section title="Change Log - new items">
        <ForEachItemInChangeLog type="new">
            <Text>#{Name} </Text>
        </ForEachItemInChangeLog>
    </Section>

    <Section title="Change Log - deleted items">
        <ForEachItemInChangeLog type="deleted">
            <Text>#{Name} </Text>
        </ForEachItemInChangeLog>
    </Section>

</Report> 

Example Result


It is also possible to include additional information about the item, e.g., LastChanged, LastChangedBy, Type name, in the log as shown below. 


Example Configuration

... 
    <Section title="Change Log - updated items"> 
        <ForEachItemInChangeLog type="updated">
            <Text>#{Name}   #{LastChanged}    #{? LastChangedBy.RealName}   [#{Type.Name}]</Text> 
        </ForEachItemInChangeLog> 
    </Section>  
...   

Example Result


Example Configuration

This example includes a table to structure the item information.

<Report>
  <Section title="ChangeLog using table"> 

    <ForEach select="/5IRS/REQS">
      <AddToChangeLog/>
      <AddReferent/>
    </ForEach>

    <Section title="All items"> 
      <Table>
        <Columns>  
          <ItemNameColumn width="100"/>
          <ItemTypeColumn width="100"/>
          <TextColumn width="100" caption="Changed By">#{? LastChangedBy.RealName }</TextColumn>
          <ItemLastChangedColumn caption="Changed" format="yyyy-mm-dd" width="100"/>
          <TextColumn width="50" caption="PageNo">#{Referent.PageNo}</TextColumn>
        </Columns>
        <ForEachItemInChangeLog>
          <Row/>
        </ForEachItemInChangeLog>
      </Table>
    </Section>

    <Section title="New items">
      <Table>
        <Columns>
          <ItemNameColumn width="100"/>
          <ItemTypeColumn width="100"/>
          <TextColumn width="100" caption="Changed By">#{? LastChangedBy.RealName }</TextColumn>
          <ItemLastChangedColumn caption="Changed" format="yyyy-mm-dd" width="100"/>
          <TextColumn width="50" caption="PageNo">#{Referent.PageNo}</TextColumn>
        </Columns>
        <ForEachItemInChangeLog type="new">
          <Row/>
        </ForEachItemInChangeLog>
      </Table>
    </Section>

    <Section title="Updated items">
      <Table>
        <Columns>
          <ItemNameColumn width="100"/>
          <ItemTypeColumn width="100"/>
          <TextColumn width="100" caption="Changed By">#{? LastChangedBy.RealName }</TextColumn>
          <ItemLastChangedColumn caption="Changed" format="yyyy-mm-dd" width="100"/>
          <TextColumn width="50" caption="PageNo">#{Referent.PageNo}</TextColumn>
        </Columns>
        <ForEachItemInChangeLog type="updated">
          <Row/>
        </ForEachItemInChangeLog>
      </Table>
    </Section>

    <Section title="Deleted items">
      <Table>
        <Columns>
          <ItemNameColumn width="100"/>
          <ItemTypeColumn width="100"/>
          <TextColumn width="100" caption="Changed By">#{? LastChangedBy.RealName }</TextColumn>
          <ItemLastChangedColumn caption="Changed" format="yyyy-mm-dd" width="100"/>
          <TextColumn width="50" caption="PageNo">#{? 'NA'}</TextColumn>
        </Columns>
        <ForEachItemInChangeLog type="deleted">
          <Row/>
        </ForEachItemInChangeLog>
      </Table>
    </Section>

  </Section>

</Report>

The following elements were used in the above example for defining the table:


<Table>

A table was created for each change log type, i.e., all, new, updated or deleted.


<TextColumn width="100" caption="Changed By">#{? LastChangedBy.RealName }</TextColumn>

A text column is used to display the display name of the user who did the last change.


<ItemLastChangedColumn caption="Changed" format="yyyy-mm-dd" width="100"/>

ItemlastChangeCoulmn is used to allow for formating the data, e.g., "yyyy-mm-dd",  "yyyy-mm", etc. 


<AddReferent/>

ddReferent tag which is needed in order to get the page number in the table. Note: to preview the page numbers, you will need to use Print Preview. 


<TextColumn width="50" caption="PageNo">#{Referent.PageNo}</TextColumn>

A text column for Referent.PageNo is used for adding the page number to the table.


Example Result


Example Using ChangeLog

Example Configuration

<Report>
	<Section title="Alternative #1: ChangeLog without table">

		<Section title="All Items">
			<ChangeLog/>
		</Section>

		<Section title="Change Log">
			<Section title="New items"> 
				<ChangeLog type="new" name_format="#{Name} [#{Type.Name}]"/> 
			</Section> 

			<Section title="Updated items">
				<ChangeLog type="updated" id_format="#{PrimaryAttribute}" name_format="#{Name} [#{Type.Name}]" /> 
			</Section>

			<Section title="Deleted items">
				<ChangeLog type="deleted" name_format="#{Name} [#{Type.Name}]"/>
			</Section>

		</Section>

		<ForEach select="/5IRS/REQS">
			<AddToChangeLog/>
			<AddReferent/>
		</ForEach>  
   
	</Section>
</Report>

Example Result



What's Next?

Learn more about the available change log tags and options in Configuring a Change Log or in the SystemWeaver Script Language Reference Manual in the application Help.