AnsweredAssumed Answered

look for several fields in xml and put condition on them

Question asked by akhajooei272797 on Dec 6, 2016
Latest reply on Dec 7, 2016 by akhajooei272797

Hi,

 

I have the following xml somewhere in my process which basically is all the education records for a user:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<tpResponse><talentProfiles><talentProfile><responseSections><responseSection>

<records>

<record><id>102893</id><sequenceNumber>1</sequenceNumber><values><value><picklistOptionId>100187</picklistOptionId><refId>230</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value></value><value><picklistOptionId>58</picklistOptionId><refId>290</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value></value><value><picklistOptionId>1</picklistOptionId><refId>240</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value></value><value><picklistOptionId>100003</picklistOptionId><refId>250</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value></value><value><refId>241</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">art(text)</value></value><value><refId>260</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:dateTime">2013-03-01T00:00:00-05:00</value></value><value><refId>270</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:dateTime">2015-08-01T00:00:00-04:00</value></value></values></record>

 

<record><id>102894</id><sequenceNumber>2</sequenceNumber><values><value><picklistOptionId>100186</picklistOptionId><refId>230</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value></value><value><picklistOptionId>-1</picklistOptionId><refId>290</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value></value><value><picklistOptionId>4</picklistOptionId><refId>240</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value></value><value><picklistOptionId>-1</picklistOptionId><refId>250</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value></value><value><refId>241</refId><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value></value><value><refId>260</refId></value><value><refId>270</refId></value></values></record>

</records><refId>20</refId></responseSection></responseSections><username>ts_test</username></talentProfile></talentProfiles><totalCount>1</totalCount><versionId>12206</versionId></tpResponse>

 

 

I also get records from another system in individual documents. I can also map that in the <record> format like below:

 

<record>
  <values xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <value>
      <picklistOptionId>-1</picklistOptionId>
      <refId>230</refId>
      <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">NO_VALUE</value>
    </value>
    <value>
      <picklistOptionId>3</picklistOptionId>
      <refId>240</refId>
      <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string" />
    </value>
    <value>
      <refId>250</refId>
      <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">NO_VALUE</value>
    </value>
    <value>
      <refId>260</refId>
      <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:dateTime">2012-01-01T00:00:00-05:00</value>
    </value>
    <value>
      <refId>270</refId>
      <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:dateTime">2015-01-01T00:00:00-05:00</value>
    </value>
    <value>
      <value xmlns:xs="http://www.w3.org/2001/XMLSchema">NO_VALUE</value>
    </value>
    <value>
      <refId>241</refId>
      <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">Art</value>
    </value>
  </values>
</record>

 

now, what I need to do is for values with <refId> of 260 I need to check if the value matches the 1st xml I get above, in this example from the 2nd xml this value is 2012-01-01T00:00:00-05:00 and in the 1st xml in the 1st record this value is 2013-03-01T00:00:00-05:00 so the answer should be false.

I need to do the same for two other fields: refId 240 and refId 241. the goal is to basically for loop on all the records in teh 1st xml and see if there is any record that all this three fields match with the 2nd xml to find duplicates.

 

I am stuck on how to do this in Boomi, I would appreciate your help!

Outcomes