7 Replies Latest reply on Oct 16, 2018 10:17 AM by Prakash Jain

    ICRT Response check

    Kumar Garikapati New Member

      I have a scenario where i need to compare two response objects(One response object from Web resource and one response from database) which will return multiple records based up on a unique identifier. When the unique identifier row matches response from web resource should be passed as final response. When unique identifier does not match i need send responses from both sources as final response. Any help in providing the model algorithm? Pl advice.

        • 1. Re: ICRT Response check
          Sorabh Agarwal Support Moderators

          Hi Kumar,

          I can think of a solution by:

           

          1. Creating boolean variable that defines match or not, using assignment step.

          2. Using Assignment step -> Expression Editor to compare the value coming from two process objects

          3. Using Jump step to iterate over the list

          4. Updating the boolean variable with an AND or OR clause as per the requirement

           

          Hope this helps,

          Sorabh

          • 2. Re: ICRT Response check
            Prakash Jain Guru

            Hi Garikapati,

             

            Please let me know if you have any further questions on this thread.

             

            Thanks,

            Prakash Jain

            • 3. Re: ICRT Response check
              Kumar Garikapati New Member

              This is the xml response from webservice..

               

               

               

               

               

               

              Response from service:

               

               

                 

               

               

                 

               

               

                   <root>

               

               

                           <row>

               

               

                              <Phone_Number></Phone_Number>

               

               

                              <Last_Name></Last_Name>

               

               

                              <First_Name></First_Name>

               

               

                              <Zip></Zip>

               

               

                              <Email>/Email>

               

               

                              <SalaryGrade/>

               

               

                              <City></City>

               

               

                              <Address1></Address1>

               

               

                              <Address2/>

               

               

                              <MiddleName/>

               

               

                              <ConsumerID>1</ConsumerID>

               

               

                              <State/>

               

               

                              <Country></Country>

               

               

                              <MiddleInitial/>

               

               

                              <FormerCDSID/>

               

               

                              <IncrementalTag/>

               

               

                              <ETag1/>

               

               

                              <ETag2/>

               

               

                              <LTag1/>

               

               

                              <LTag2/>

               

               

                              <PartyType></PartyType>

               

               

                              <SourceSystemName></SourceSystemName>

               

               

                           </row>

               

               

                            <root>

               

               

                            <row>

               

               

                               <Phone_Number></Phone_Number>

               

               

                               <Last_Name></Last_Name>

               

               

                               <First_Name></First_Name>

               

               

                               <Zip></Zip>

               

               

                               <Email>/Email>

               

               

                               <SalaryGrade/>

               

               

                               <City></City>

               

               

                               <Address1></Address1>

               

               

                               <Address2/>

               

               

                               <MiddleName/>

               

               

                               <ConsumerID>2</ConsumerID>

               

               

                               <State/>

               

               

                               <Country></Country>

               

               

                               <MiddleInitial/>

               

               

                               <FormerCDSID/>

               

               

                               <IncrementalTag/>

               

               

                               <ETag1/>

               

               

                               <ETag2/>

               

               

                               <LTag1/>

               

               

                               <LTag2/>

               

               

                               <PartyType></PartyType>

               

               

                               <SourceSystemName></SourceSystemName>

               

               

                            </row>

               

               

                    </root>

               

               

                     <root>

               

               

                             <row>

               

               

                                <Phone_Number></Phone_Number>

               

               

                                <Last_Name></Last_Name>

               

               

                                <First_Name></First_Name>

               

               

                                <Zip></Zip>

               

               

                                <Email>/Email>

               

               

                                <SalaryGrade/>

               

               

                                <City></City>

               

               

                                <Address1></Address1>

               

               

                                <Address2/>

               

               

                                <MiddleName/>

               

               

                                <ConsumerID>3</ConsumerID>

               

               

                                <State/>

               

               

                                <Country></Country>

               

               

                                <MiddleInitial/>

               

               

                                <FormerCDSID/>

               

               

                                <IncrementalTag/>

               

               

                                <ETag1/>

               

               

                                <ETag2/>

               

               

                                <LTag1/>

               

               

                                <LTag2/>

               

               

                                <PartyType></PartyType>

               

               

                                <SourceSystemName></SourceSystemName>

               

               

                             </row>

               

               

                    </root>

               

               

                     <root>

               

               

                             <row>

               

               

                                <Phone_Number></Phone_Number>

               

               

                                <Last_Name></Last_Name>

               

               

                                <First_Name></First_Name>

               

               

                                <Zip></Zip>

               

               

                                <Email>/Email>

               

               

                                <SalaryGrade/>

               

               

                                <City></City>

               

               

                                <Address1></Address1>

               

               

                                <Address2/>

               

               

                                <MiddleName/>

               

               

                                <ConsumerID>4</ConsumerID>

               

               

                                <State/>

               

               

                                <Country></Country>

               

               

                                <MiddleInitial/>

               

               

                                <FormerCDSID/>

               

               

                                <IncrementalTag/>

               

               

                                <ETag1/>

               

               

                                <ETag2/>

               

               

                                <LTag1/>

               

               

                                <LTag2/>

               

               

                                <PartyType></PartyType>

               

               

                                <SourceSystemName></SourceSystemName>

               

               

                             </row>

               

               

                    </root>

               

               

                    </root>

               

               

                   

               

               

              and

               

               

               

               

               

               

              Response from database

               

               

               

               

               

               

                  Response from  Database:     

               

               

                 

               

               

                                 

               

               

                         <root>

               

               

                                 <row>

               

               

                                    <Phone_Number></Phone_Number>

               

               

                                    <Last_Name></Last_Name>

               

               

                                    <First_Name></First_Name>

               

               

                                    <Zip></Zip>

               

               

                                    <Email>/Email>

               

               

                                    <SalaryGrade/>

               

               

                                    <City></City>

               

               

                                    <Address1></Address1>

               

               

                                    <Address2/>

               

               

                                    <MiddleName/>

               

               

                                    <ConsumerID>5

               

               

                                    </ConsumerID>

               

               

                                    <State/>

               

               

                                    <Country></Country>

               

               

                                    <MiddleInitial/>

               

               

                                    <FormerCDSID/>

               

               

                                    <IncrementalTag/>

               

               

                                    <ETag1/>

               

               

                                    <ETag2/>

               

               

                                    <LTag1/>

               

               

                                    <LTag2/>

               

               

                                    <PartyType></PartyType>

               

               

                                    <SourceSystemName></SourceSystemName>

               

               

                                 </row>

               

               

                        </root>

               

               

                       

               

               

               

               

               

               

              If the Consumer id column matches from web resource and database the final response will have all the xml response from web resource and if do not match the final response should contain the complete response from web resource and database like mentioned below.

               

               

               

               

               

               

              <root>

               

               

                           <row>

               

               

                              <Phone_Number></Phone_Number>

               

               

                              <Last_Name></Last_Name>

               

               

                              <First_Name></First_Name>

               

               

                              <Zip></Zip>

               

               

                              <Email>/Email>

               

               

                              <SalaryGrade/>

               

               

                              <City></City>

               

               

                              <Address1></Address1>

               

               

                              <Address2/>

               

               

                              <MiddleName/>

               

               

                              <ConsumerID>1</ConsumerID>

               

               

                              <State/>

               

               

                              <Country></Country>

               

               

                              <MiddleInitial/>

               

               

                              <FormerCDSID/>

               

               

                              <IncrementalTag/>

               

               

                              <ETag1/>

               

               

                              <ETag2/>

               

               

                              <LTag1/>

               

               

                              <LTag2/>

               

               

                              <PartyType></PartyType>

               

               

                              <SourceSystemName></SourceSystemName>

               

               

                           </row>

               

               

                            <root>

               

               

                            <row>

               

               

                               <Phone_Number></Phone_Number>

               

               

                               <Last_Name></Last_Name>

               

               

                               <First_Name></First_Name>

               

               

                               <Zip></Zip>

               

               

                               <Email>/Email>

               

               

                               <SalaryGrade/>

               

               

                               <City></City>

               

               

                               <Address1></Address1>

               

               

                               <Address2/>

               

               

                               <MiddleName/>

               

               

                               <ConsumerID>2</ConsumerID>

               

               

                               <State/>

               

               

                               <Country></Country>

               

               

                               <MiddleInitial/>

               

               

                               <FormerCDSID/>

               

               

                               <IncrementalTag/>

               

               

                               <ETag1/>

               

               

                               <ETag2/>

               

               

                               <LTag1/>

               

               

                               <LTag2/>

               

               

                               <PartyType></PartyType>

               

               

                               <SourceSystemName></SourceSystemName>

               

               

                            </row>

               

               

                    </root>

               

               

                     <root>

               

               

                             <row>

               

               

                                <Phone_Number></Phone_Number>

               

               

                                <Last_Name></Last_Name>

               

               

                                <First_Name></First_Name>

               

               

                                <Zip></Zip>

               

               

                                <Email>/Email>

               

               

                                <SalaryGrade/>

               

               

                                <City></City>

               

               

                                <Address1></Address1>

               

               

                                <Address2/>

               

               

                                <MiddleName/>

               

               

                                <ConsumerID>3</ConsumerID>

               

               

                                <State/>

               

               

                                <Country></Country>

               

               

                                <MiddleInitial/>

               

               

                                <FormerCDSID/>

               

               

                                <IncrementalTag/>

               

               

                                <ETag1/>

               

               

                                <ETag2/>

               

               

                                <LTag1/>

               

               

                                <LTag2/>

               

               

                                <PartyType></PartyType>

               

               

                                <SourceSystemName></SourceSystemName>

               

               

                             </row>

               

               

                    </root>

               

               

                     <root>

               

               

                             <row>

               

               

                                <Phone_Number></Phone_Number>

               

               

                                <Last_Name></Last_Name>

               

               

                                <First_Name></First_Name>

               

               

                                <Zip></Zip>

               

               

                                <Email>/Email>

               

               

                                <SalaryGrade/>

               

               

                                <City></City>

               

               

                                <Address1></Address1>

               

               

                                <Address2/>

               

               

                                <MiddleName/>

               

               

                                <ConsumerID>4</ConsumerID>

               

               

                                <State/>

               

               

                                <Country></Country>

               

               

                                <MiddleInitial/>

               

               

                                <FormerCDSID/>

               

               

                                <IncrementalTag/>

               

               

                                <ETag1/>

               

               

                                <ETag2/>

               

               

                                <LTag1/>

               

               

                                <LTag2/>

               

               

                                <PartyType></PartyType>

               

               

                                <SourceSystemName></SourceSystemName>

               

               

                             </row>

               

               

                    </root>

               

               

                    </root>

               

               

              <root>

               

               

                                 <row>

               

               

                                    <Phone_Number></Phone_Number>

               

               

                                    <Last_Name></Last_Name>

               

               

                                    <First_Name></First_Name>

               

               

                                    <Zip></Zip>

               

               

                                    <Email>/Email>

               

               

                                    <SalaryGrade/>

               

               

                                    <City></City>

               

               

                                    <Address1></Address1>

               

               

                                    <Address2/>

               

               

                                    <MiddleName/>

               

               

                                    <ConsumerID>5

               

               

                                    </ConsumerID>

               

               

                                    <State/>

               

               

                                    <Country></Country>

               

               

                                    <MiddleInitial/>

               

               

                                    <FormerCDSID/>

               

               

                                    <IncrementalTag/>

               

               

                                    <ETag1/>

               

               

                                    <ETag2/>

               

               

                                    <LTag1/>

               

               

                                    <LTag2/>

               

               

                                    <PartyType></PartyType>

               

               

                                    <SourceSystemName></SourceSystemName>

               

               

                                 </row>

               

               

                        </root>

              • 4. Re: ICRT Response check
                bhim mantha Guru

                Would you please in the above example tell us what's the identifier and then please attach the sample response rather than pasting it inline . It's very difficult to read .

                 

                For example :

                 

                Send us the identifier to look for

                 

                Attach the two sample payloads .

                 

                We can help you with the Query to achieve this

                 

                -Bhim

                • 5. Re: ICRT Response check
                  Kumar Garikapati New Member

                  Hi Bhim - Both the payloads are same actually. I have highlighted the identifier. The Expectation is available from in the final response segment.

                  Response from Service

                  <root>

                  <row>

                  <Phone_Number></Phone_Number>

                  <Last_Name></Last_Name>

                  <First_Name></First_Name>

                  <Zip></Zip>

                  <Email>/Email>

                  <SalaryGrade/>

                  <City></City>

                  <Address1></Address1>

                  <Address2/>

                  <MiddleName/>

                  <ConsumerID>1</ConsumerID>

                  <State/>

                  <Country></Country>

                  <MiddleInitial/>

                  <FormerCDSID/>

                  <IncrementalTag/>

                  <ETag1/>

                  <ETag2/>

                  <LTag1/>

                  <LTag2/>

                  <PartyType></PartyType>

                  <SourceSystemName></SourceSystemName>

                  </row>

                   

                  <root>

                  <row>

                  <Phone_Number></Phone_Number>

                  <Last_Name></Last_Name>

                  <First_Name></First_Name>

                  <Zip></Zip>

                  <Email>/Email>

                  <SalaryGrade/>

                  <City></City>

                  <Address1></Address1>

                  <Address2/>

                  <MiddleName/>

                  <ConsumerID>2</ConsumerID>

                  <State/>

                  <Country></Country>

                  <MiddleInitial/>

                  <FormerCDSID/>

                  <IncrementalTag/>

                  <ETag1/>

                  <ETag2/>

                  <LTag1/>

                  <LTag2/>

                  <PartyType></PartyType>

                  <SourceSystemName></SourceSystemName>

                  </row>

                   

                  Response from  Database:    

                  <root>

                  <row>

                  <Phone_Number></Phone_Number>

                  <Last_Name></Last_Name>

                  <First_Name></First_Name>

                  <Zip></Zip>

                  <Email>/Email>

                  <SalaryGrade/>

                  <City></City>

                  <Address1></Address1>

                  <Address2/>

                  <MiddleName/>

                  <ConsumerID>5</ConsumerID>

                  <State/>

                  <Country></Country>

                  <MiddleInitial/>

                  <FormerCDSID/>

                  <IncrementalTag/>

                  <ETag1/>

                  <ETag2/>

                  <LTag1/>

                  <LTag2/>

                  <PartyType></PartyType>

                  <SourceSystemName></SourceSystemName>

                  </row>

                  </root>

                  <root>

                  <row>

                  <Phone_Number></Phone_Number>

                  <Last_Name></Last_Name>

                  <First_Name></First_Name>

                  <Zip></Zip>

                  <Email>/Email>

                  <SalaryGrade/>

                  <City></City>

                  <Address1></Address1>

                  <Address2/>

                  <MiddleName/>

                  <ConsumerID>1</ConsumerID>

                  <State/>

                  <Country></Country>

                  <MiddleInitial/>

                  <FormerCDSID/>

                  <IncrementalTag/>

                  <ETag1/>

                  <ETag2/>

                  <LTag1/>

                  <LTag2/>

                  <PartyType></PartyType>

                  <SourceSystemName></SourceSystemName>

                  </row>

                  </root>

                   

                  Final Response

                  root>

                  <row>

                  <Phone_Number></Phone_Number>

                  <Last_Name></Last_Name>

                  <First_Name></First_Name>

                  <Zip></Zip>

                  <Email>/Email>

                  <SalaryGrade/>

                  <City></City>

                  <Address1></Address1>

                  <Address2/>

                  <MiddleName/>

                  <ConsumerID>1</ConsumerID>

                  <State/>

                  <Country></Country>

                  <MiddleInitial/>

                  <FormerCDSID/>

                  <IncrementalTag/>

                  <ETag1/>

                  <ETag2/>

                  <LTag1/>

                  <LTag2/>

                  <PartyType></PartyType>

                  <SourceSystemName></SourceSystemName>

                  </row>

                   

                  <root>

                  <row>

                  <Phone_Number></Phone_Number>

                  <Last_Name></Last_Name>

                  <First_Name></First_Name>

                  <Zip></Zip>

                  <Email>/Email>

                  <SalaryGrade/>

                  <City></City>

                  <Address1></Address1>

                  <Address2/>

                  <MiddleName/>

                  <ConsumerID>2</ConsumerID>

                  <State/>

                  <Country></Country>

                  <MiddleInitial/>

                  <FormerCDSID/>

                  <IncrementalTag/>

                  <ETag1/>

                  <ETag2/>

                  <LTag1/>

                  <LTag2/>

                  <PartyType></PartyType>

                  <SourceSystemName></SourceSystemName>

                  </row>

                  <root>

                  <row>

                  <Phone_Number></Phone_Number>

                  <Last_Name></Last_Name>

                  <First_Name></First_Name>

                  <Zip></Zip>

                  <Email>/Email>

                  <SalaryGrade/>

                  <City></City>

                  <Address1></Address1>

                  <Address2/>

                  <MiddleName/>

                  <ConsumerID>5</ConsumerID>

                  <State/>

                  <Country></Country>

                  <MiddleInitial/>

                  <FormerCDSID/>

                  <IncrementalTag/>

                  <ETag1/>

                  <ETag2/>

                  <LTag1/>

                  <LTag2/>

                  <PartyType></PartyType>

                  <SourceSystemName></SourceSystemName>

                  </row>

                  </root>

                  • 6. Re: ICRT Response check
                    Prakash Jain Guru

                    Hi Kumar,

                     

                    You can use an assignment step. The Xquery pseudo code for the same would look like below:

                     

                    let $XMLData:= $WebServiceData

                     

                    let $XMLData:= list:append($DatabaseVariable)                // Get all the entire XML into one variable

                     

                    let $UniqueValue:=  distinct-values($XMLData/ConsumerID)       // find the unique Consumer IDs

                     

                    let $duplicateValues:=for $id in distinct-values($XMLData/ConsumerID)  // find the duplicate Consumer IDs

                    where count($XMLData//ConsumerID=$id) gt 1

                    return $id

                     

                    {

                      for $i in //UniqueValue                              //Loop through unique Ids and get the data from WebService

                      return $WebSerivce[/ConsumerID=$i]

                    }

                    {

                      for $i in //UniqueValue                              //Loop through unique Ids and get the data from database

                      return $Database[/ConsumerID=$i]

                    }

                    {

                      for $j in //duplicateValues                         //Loop through unique Ids and get the data from Webservice alone

                      return $WebSerivce[/ConsumerID=$j]

                    }

                     

                     

                    Thanks,

                    Prakash Jain

                    • 7. Re: ICRT Response check
                      Prakash Jain Guru

                      Hi Kumar,

                       

                      Please find the updated working code:

                       

                       

                      let $databaseCustomerIds:= data($database//consumerID)

                       

                      let $WebserviceCustomerIds:= data($WebserviceData//consumerID)

                       

                      let $XMLData:= ($WebserviceData//row, $database//row)

                       

                      let $duplicateValues:= distinct-values($databaseCustomerIds[(.=$WebserviceCustomerIds)])

                       

                      let $exclusionValues:= distinct-values($databaseCustomerIds[not(.=$WebserviceCustomerIds)])

                       

                      let $ResultWebservice:=for $i in $WebserviceData//row

                      return

                      if( $duplicateValues = $i/consumerID/text()) then $i else ()

                       

                       

                      let $ResultDatabase:=for $j in $database//row

                      return

                      if( $exclusionValues = $j/consumerID/text()) then $j else ()

                       

                      return  ($ResultWebservice, $ResultDatabase)

                       

                       

                      Thanks,

                      Prakash Jain