I have a simple xml with several InterimConditionEvent
ID's. I would like to get the InterimConditionEvent ID
with the highest value.
For my xml I would like to get <InterimConditionEvent ID="160850209">
because this has the highest value.
How do I do that in VB.Net?
My xml
<Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="http://tsgweb.com" xmlns:IXML="http://tsgweb.com" xmlns:CMCodeQueryHelper="urn:CMCodeQueryHelper">
<Case InternalID="1617095448" ID="12131576" xmlns:user="http://tylertechnologies.com">
<InterimConditionEvent ID="160850198">
<OrderDate>08/14/2015</OrderDate>
<ExpirationDate>08/14/2015</ExpirationDate>
<TimestampCreate>08/14/2015 11:01:57:700</TimestampCreate>
<TimestampChange>08/14/2015 11:21:51:623</TimestampChange>
<Deleted>true</Deleted>
<InterimCondition>
<ConditionType Word="DOMNC">Domestic No Contact</ConditionType>
<EffectiveDate>8/14/2015</EffectiveDate>
<EndDate>8/21/2015</EndDate>
</InterimCondition>
</InterimConditionEvent>
<InterimConditionEvent ID="160850209">
<OrderDate>08/14/2015</OrderDate>
<ExpirationDate>08/14/2015</ExpirationDate>
<TimestampCreate>08/14/2015 11:22:28:900</TimestampCreate>
<TimestampChange>08/14/2015 11:31:15:890</TimestampChange>
<Deleted>true</Deleted>
<InterimCondition>
<ConditionType Word="DOMNC">Domestic No Contact</ConditionType>
<EffectiveDate>8/14/2015</EffectiveDate>
<EndDate>8/14/2015</EndDate>
</InterimCondition>
</InterimConditionEvent>
</Case>
In my vb.net code, I am using the last position but I realized this could return last position that do not have the latest date or time. Here is my vb.net last position code which I would like to change to use ID with the highest value.
strOrderEndDate = objXmlCaseDoc
.DocumentElement
.SelectSingleNode("Case/InterimConditionEvent[position()=last()]/InterimCondition[ConditionType/@Word='DOMNC']/EndDate").InnerText