创建新话题

Comparing two versions of a structure

I want to compare the diagnostic content of two different versions of an ECU. Is there a way to do that with the script language?


2 人 有同样的问题

We should not forget about the standard view option available in the Versions/Compare option in the CM group:


image


In the dialog you select the version to compare with, and the differences can be seen in the structure three.

This option is described in detail in the Help section Versions compare in the structure tree.

(Gray fill means missing in version, yellow means different version, white means same version)

image



Hi,


You can add a parameter to select the version to compare to:


 <Parameters>

  <Parameter name="p1" caption="Diff version">

   <Values>

    <Variable name="selVersion" select="." as="Items"/>

    <ForEach select="AllVersions">

     <If test="not . in $selVersion">

      <AddValue/>

     </If>

    </ForEach>

   </Values>

  </Parameter>

 </Parameters>


Then you can add the contents that you want to compare to two different variables, one containing the contents for the previous version and one for the current version. You get the previous version from the parameter.


 <Variable name="diffVersion" select="$p1/IFP2/IF11" as="Items"/>

 <Variable name="currentVersion" select="/IFP2/IF11" as="Items"/>


From there you can create functions to find the added, deleted and changed items:


 <Function name="added" as="Items">

  <Parameter name="prev" as="Items"/>

  <Parameter name="curr" as="Items"/>

  <Value select="$curr[not AncestorHandle in $prev.Select(AncestorHandle)]"/>

 </Function>

 

 <Function name="changed" as="Items">

  <Parameter name="prev" as="Items"/>

  <Parameter name="curr" as="Items"/>

  <Variable name="same" select="$curr[AncestorHandle in $prev.Select(AncestorHandle)]" as="Items"/>

  <Value select="$same[not Handle in $prev.Select(Handle)]"/>

 </Function>

 <Function name="deleted" as="Items">

  <Parameter name="prev" as="Items"/>

  <Parameter name="curr" as="Items"/>

  <Value select="$prev[not AncestorHandle in $curr.Select(AncestorHandle)]"/>

 </Function> 


Best regards

Martin

登录 发表评论