Wiki source code of SyncWith Property
Last modified by Outhman Moustaghfir on 2024/10/23 11:47
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | = = | ||
2 | |||
3 | = = | ||
4 | |||
5 | = Introduction = | ||
6 | |||
7 | The syncWith property is used to establish synchronization between two different trackings that have distinct trackingTypes. | ||
8 | |||
9 | = Setup = | ||
10 | |||
11 | let's suppose that we have 2 'trackingTypes' : 'TrkA'', 'TrkB'. | ||
12 | |||
13 | if we chose to synchronize the __//TrkB// __with __//TrkA//__, we need to update it on the 'Tracking Editor' page : | ||
14 | |||
15 | |||
16 | **TrkA : ** | ||
17 | |||
18 | [[image:1729673378212-849.png]] | ||
19 | |||
20 | |||
21 | **TrkB : ** | ||
22 | |||
23 | [[image:1729673369343-934.png]] | ||
24 | |||
25 | = Usage = | ||
26 | |||
27 | The use of `syncWith` covers both the creation and updating of a tracking by setting **the same `TrkID`** for synchronized trackings.** It ensures that only the shared `dataTypes` between the trackings are synchronized.** | ||
28 | |||
29 | By taking the last example, let's create a 'TrkB' tracking using setTracking : | ||
30 | |||
31 | {{code language="XML"}} | ||
32 | <?xml version="1.0" encoding="windows-1251"?> | ||
33 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" | ||
34 | xmlns:ixf="http://www.ixPath.com/Function" xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
35 | xmlns:ix="localFunction"> | ||
36 | <xsl:output method="xml" indent="yes" ></xsl:output> | ||
37 | <!-- Beginning of the Translation --> | ||
38 | <xsl:template match="/"> | ||
39 | <xsl:variable name="varrr"> | ||
40 | <Trk> | ||
41 | <TrkB> | ||
42 | <Name>Santos</Name> | ||
43 | <City>Rio</City> | ||
44 | <Country>Brazil</Country> | ||
45 | </TrkB> | ||
46 | |||
47 | <TrkB> | ||
48 | <Name>Roberto</Name> | ||
49 | <City>Torino</City> | ||
50 | <Country>Italy</Country> | ||
51 | </TrkB> | ||
52 | </Trk> | ||
53 | </xsl:variable> | ||
54 | <iXDOC> | ||
55 | <testt> | ||
56 | <xsl:value-of select="ixf:SetTracking($varrr)" ></xsl:value-of> | ||
57 | <!-- <xsl:value-of select="ixf:RemoveTracking('TrkA', | ||
58 | '6717c0d3f2e8d678a560e6ff','true')" ></xsl:value-of> --> | ||
59 | </testt> | ||
60 | |||
61 | </iXDOC> | ||
62 | </xsl:template> | ||
63 | |||
64 | </xsl:stylesheet> | ||
65 | {{/code}} | ||
66 | |||
67 | |||
68 | the result for **TrkA **and **TrkB, with GetTracking : | ||
69 | {{code language="XML"}}<testtt> | ||
70 | <xsl:copy-of select="ixf:GetTracking('TrkB[id=6718bab123b8281ad212c4cf]')" ></xsl:copy-of> | ||
71 | <xsl:copy-of select="ixf:GetTracking('TrkA[id=6718bab123b8281ad212c4cf]')" ></xsl:copy-of> | ||
72 | |||
73 | </testtt>{{/code}}** | ||
74 | |||
75 | {{code language="XML"}} | ||
76 | <?xml version="1.0" encoding="UTF-8"?> | ||
77 | <iXDOC xmlns:ix="localFunction" | ||
78 | xmlns:ixf="http://www.ixPath.com/Function" | ||
79 | xmlns:xs="http://www.w3.org/2001/XMLSchema"> | ||
80 | <testtt> | ||
81 | <iXDoc> | ||
82 | <TrkB CreationDate="2024-10-23 08:58:25" | ||
83 | Current="true" | ||
84 | EnvID="R1" | ||
85 | ModificationDate="2024-10-23 08:58:25" | ||
86 | Status="Available" | ||
87 | UserID="" | ||
88 | Version="1" | ||
89 | VersionID="6718bab123b8281ad212c4cf" | ||
90 | id="6718bab123b8281ad212c4cf"> | ||
91 | <City>Rio</City> | ||
92 | <Name>Santos</Name> | ||
93 | <_accessStatus>OPEN</_accessStatus> | ||
94 | <_accessStatusHistory> | ||
95 | <modificationDate>2024-10-23 08:58:25</modificationDate> | ||
96 | <accessStatus>OPEN</accessStatus> | ||
97 | </_accessStatusHistory> | ||
98 | <Country>Brazil</Country> | ||
99 | </TrkB> | ||
100 | </iXDoc> | ||
101 | <iXDoc> | ||
102 | <TrkA CreationDate="2024-10-23 08:58:25" | ||
103 | Current="true" | ||
104 | EnvID="R1" | ||
105 | ModificationDate="2024-10-23 08:58:25" | ||
106 | Status="Available" | ||
107 | UserID="" | ||
108 | Version="1" | ||
109 | VersionID="6718bab123b8281ad212c4d0" | ||
110 | id="6718bab123b8281ad212c4cf"> | ||
111 | <City>Rio</City> | ||
112 | <Name>Santos</Name> | ||
113 | <_syncWith>TrkB</_syncWith> | ||
114 | <_accessStatus>OPEN</_accessStatus> | ||
115 | <_accessStatusHistory> | ||
116 | <modificationDate>2024-10-23 08:58:25</modificationDate> | ||
117 | <accessStatus>OPEN</accessStatus> | ||
118 | </_accessStatusHistory> | ||
119 | </TrkA> | ||
120 | </iXDoc> | ||
121 | </testtt> | ||
122 | </iXDOC> | ||
123 | |||
124 | {{/code}} | ||
125 | |||
126 | As you can see, a tracking '**TrkA**' has been created automatically with the same TrkID, and a metadata '_syncWith' that maps the related syncWith tracking '**TrkB**'. | ||
127 | |||
128 | ==== Handled Cases ==== | ||
129 | |||
130 | * The __update__ of a tracking that has **'syncWith' metadata** will update automatically the tracking associated and vice versa. | ||
131 | * The __delete __of tracking synchronized can delete all its trackings related, to enable this option in **[[RemoveTracking function>>doc:iXPath V3.Functions.XSLT .tracking.RemoveTracking.WebHome]]** you add a third boolean param as true. | ||
132 | eg : {{code language="XML"}}<xsl:value-of select="ixf:RemoveTracking('TrkA','6717c0d3f2e8d678a560e6ff;6718bab123b8281ad212c4cf','true')" /> | ||
133 | {{/code}} | ||
134 | * By taking our use case, if a **new TrkA** is created, this will not create another TrkB , since only TrkB can be synchronized through trackingType. | ||
135 | |||
136 |