T
thecolour
Dear all
I have a diffgram:
<?xml version="1.0" standalone="yes"?>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet>
<PolicyInwards diffgr:id="PolicyInwards1" msdata:rowOrder="0"
diffgr:hasChanges="modified">
<PolicyID>POL0001</PolicyID>
<InsuredName>Insured Co 111</InsuredName>
<InceptDate>2007-01-01T00:00:00+00:00</InceptDate>
<BrokerCode>BKR1</BrokerCode>
<UW>U1</UW>
<LimitCCY>GBP</LimitCCY>
<LimitAmt>1000001.00</LimitAmt>
<SharePctg>0.10</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards2" msdata:rowOrder="1"
diffgr:hasChanges="modified">
<PolicyID>POL00010</PolicyID>
<InsuredName>Insured Co 10</InsuredName>
<InceptDate>2007-01-15T00:00:00+00:00</InceptDate>
<BrokerCode>BKR10</BrokerCode>
<UW>U10</UW>
<LimitCCY>USD</LimitCCY>
<LimitAmt>1000010.00</LimitAmt>
<SharePctg>1.00</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards4" msdata:rowOrder="3"
diffgr:hasChanges="inserted">
<PolicyID>POL100040</PolicyID>
<InsuredName>Insured Co 100040</InsuredName>
<InceptDate>2281-05-19T14:44:29.63+01:00</InceptDate>
<BrokerCode>BKR 100040</BrokerCode>
<UW>UW 100040</UW>
<LimitCCY>GBP</LimitCCY>
<LimitAmt>1100040.00</LimitAmt>
<SharePctg>11.00</SharePctg>
<Status>L</Status>
</PolicyInwards>
</NewDataSet>
<diffgr:before>
<PolicyInwards diffgr:id="PolicyInwards1" msdata:rowOrder="0">
<PolicyID>POL0001</PolicyID>
<InsuredName>Insured Co 1</InsuredName>
<InceptDate>2007-01-01T00:00:00+00:00</InceptDate>
<BrokerCode>BKR1</BrokerCode>
<UW>U1</UW>
<LimitCCY>GBP</LimitCCY>
<LimitAmt>1000001.00</LimitAmt>
<SharePctg>0.10</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards2" msdata:rowOrder="1">
<PolicyID>POL00010</PolicyID>
<InsuredName>Insured Co 10</InsuredName>
<InceptDate>2007-01-02T00:00:00+00:00</InceptDate>
<BrokerCode>BKR10</BrokerCode>
<UW>U10</UW>
<LimitCCY>USD</LimitCCY>
<LimitAmt>1000010.00</LimitAmt>
<SharePctg>1.00</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards3" msdata:rowOrder="2">
<PolicyID>POL00019</PolicyID>
<InsuredName>Insured Co 19</InsuredName>
<InceptDate>2007-01-19T00:00:00+00:00</InceptDate>
<BrokerCode>BKR19</BrokerCode>
<UW>U19</UW>
<LimitCCY>EUR</LimitCCY>
<LimitAmt>1000019.00</LimitAmt>
<SharePctg>1.90</SharePctg>
<Status>L</Status>
</PolicyInwards>
</diffgr:before>
</diffgr:diffgram>
and I am trying to select all the child node names out of each
<PolicyInwards> node. Ideally I want to programatically compare the
values entered in the child nodes across different <PolicyInwards>
nodes, without having to hard code the node names themselves.
Eg I want to compare the values in elements <InsuredName>,
<InceptDate>, etc under /diffgr:diffgram/NewDataSet/
PolicyInwards[diffgr:id='PolicyInwards2'] with the same element values
under /diffgr:diffgram/Diffgr:before/
PolicyInwards[diffgr:id='PolicyInwards2'], extract the element name,
and the values of each under NewDataSet and Diffgr:before for each
element
The best I have come up with so far is
declare namespace diffgr = "urn:schemas-microsoft-com:xml-diffgram-
v1";
<ReconResults>
{
this sections gets all the differences between rows present in
both datasets
for $PolicyInwardsDifference in /diffgr:diffgram/NewDataSet/
PolicyInwards
where $PolicyInwardsDifference/diffgr:id[text() = /diffgr:diffgram/
diffgr:before/PolicyInwards/diffgr:id/text()]
return
if( $PolicyInwardsDifference/@diffgr:hasChanges[text() =
'modified'] )
then
<Difference>
<PKValue>
{$PolicyInwardsDifference/PolicyID/text()}
</PKValue>
{
for $Column in $PolicyInwardsDifference/node()
return
<Column>
<ColumnName>{$PolicyInwardsDifference[node() =
$Column]}</ColumnName>
<ValueBefore>(need to get this)</ValueSource>
<ValueAfter>(need to get this)</ValueTarget>
</Column>
}
</Difference>
else ()
}
</ReconResults>
I am happy to clarify if someone out there would be so kind as to
help
me out.
Many thanks
Tom
I have a diffgram:
<?xml version="1.0" standalone="yes"?>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet>
<PolicyInwards diffgr:id="PolicyInwards1" msdata:rowOrder="0"
diffgr:hasChanges="modified">
<PolicyID>POL0001</PolicyID>
<InsuredName>Insured Co 111</InsuredName>
<InceptDate>2007-01-01T00:00:00+00:00</InceptDate>
<BrokerCode>BKR1</BrokerCode>
<UW>U1</UW>
<LimitCCY>GBP</LimitCCY>
<LimitAmt>1000001.00</LimitAmt>
<SharePctg>0.10</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards2" msdata:rowOrder="1"
diffgr:hasChanges="modified">
<PolicyID>POL00010</PolicyID>
<InsuredName>Insured Co 10</InsuredName>
<InceptDate>2007-01-15T00:00:00+00:00</InceptDate>
<BrokerCode>BKR10</BrokerCode>
<UW>U10</UW>
<LimitCCY>USD</LimitCCY>
<LimitAmt>1000010.00</LimitAmt>
<SharePctg>1.00</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards4" msdata:rowOrder="3"
diffgr:hasChanges="inserted">
<PolicyID>POL100040</PolicyID>
<InsuredName>Insured Co 100040</InsuredName>
<InceptDate>2281-05-19T14:44:29.63+01:00</InceptDate>
<BrokerCode>BKR 100040</BrokerCode>
<UW>UW 100040</UW>
<LimitCCY>GBP</LimitCCY>
<LimitAmt>1100040.00</LimitAmt>
<SharePctg>11.00</SharePctg>
<Status>L</Status>
</PolicyInwards>
</NewDataSet>
<diffgr:before>
<PolicyInwards diffgr:id="PolicyInwards1" msdata:rowOrder="0">
<PolicyID>POL0001</PolicyID>
<InsuredName>Insured Co 1</InsuredName>
<InceptDate>2007-01-01T00:00:00+00:00</InceptDate>
<BrokerCode>BKR1</BrokerCode>
<UW>U1</UW>
<LimitCCY>GBP</LimitCCY>
<LimitAmt>1000001.00</LimitAmt>
<SharePctg>0.10</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards2" msdata:rowOrder="1">
<PolicyID>POL00010</PolicyID>
<InsuredName>Insured Co 10</InsuredName>
<InceptDate>2007-01-02T00:00:00+00:00</InceptDate>
<BrokerCode>BKR10</BrokerCode>
<UW>U10</UW>
<LimitCCY>USD</LimitCCY>
<LimitAmt>1000010.00</LimitAmt>
<SharePctg>1.00</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards3" msdata:rowOrder="2">
<PolicyID>POL00019</PolicyID>
<InsuredName>Insured Co 19</InsuredName>
<InceptDate>2007-01-19T00:00:00+00:00</InceptDate>
<BrokerCode>BKR19</BrokerCode>
<UW>U19</UW>
<LimitCCY>EUR</LimitCCY>
<LimitAmt>1000019.00</LimitAmt>
<SharePctg>1.90</SharePctg>
<Status>L</Status>
</PolicyInwards>
</diffgr:before>
</diffgr:diffgram>
and I am trying to select all the child node names out of each
<PolicyInwards> node. Ideally I want to programatically compare the
values entered in the child nodes across different <PolicyInwards>
nodes, without having to hard code the node names themselves.
Eg I want to compare the values in elements <InsuredName>,
<InceptDate>, etc under /diffgr:diffgram/NewDataSet/
PolicyInwards[diffgr:id='PolicyInwards2'] with the same element values
under /diffgr:diffgram/Diffgr:before/
PolicyInwards[diffgr:id='PolicyInwards2'], extract the element name,
and the values of each under NewDataSet and Diffgr:before for each
element
The best I have come up with so far is
declare namespace diffgr = "urn:schemas-microsoft-com:xml-diffgram-
v1";
<ReconResults>
{
this sections gets all the differences between rows present in
both datasets
for $PolicyInwardsDifference in /diffgr:diffgram/NewDataSet/
PolicyInwards
where $PolicyInwardsDifference/diffgr:id[text() = /diffgr:diffgram/
diffgr:before/PolicyInwards/diffgr:id/text()]
return
if( $PolicyInwardsDifference/@diffgr:hasChanges[text() =
'modified'] )
then
<Difference>
<PKValue>
{$PolicyInwardsDifference/PolicyID/text()}
</PKValue>
{
for $Column in $PolicyInwardsDifference/node()
return
<Column>
<ColumnName>{$PolicyInwardsDifference[node() =
$Column]}</ColumnName>
<ValueBefore>(need to get this)</ValueSource>
<ValueAfter>(need to get this)</ValueTarget>
</Column>
}
</Difference>
else ()
}
</ReconResults>
I am happy to clarify if someone out there would be so kind as to
help
me out.
Many thanks
Tom