<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Compare two Json arrays to find the new and updated records in Workato Pros Discussion Board</title>
    <link>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8973#M3701</link>
    <description>&lt;P&gt;Both requests result in List datapills. Why not load them into two SQL Collections then just use SQL joins/queries with the two SQL collections to get the resulting List, then use that resulting List datapill to update/insert into the SharePoint list?&lt;/P&gt;</description>
    <pubDate>Tue, 25 Feb 2025 03:53:01 GMT</pubDate>
    <dc:creator>blakesha</dc:creator>
    <dc:date>2025-02-25T03:53:01Z</dc:date>
    <item>
      <title>Compare two Json arrays to find the new and updated records</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8375#M3506</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;I am new to Workato, i am trying to build a data integration to sync data from Workday to SharePoint List.&lt;/P&gt;&lt;P&gt;I have employee data coming from Workday, which is also stored in a SharePoint list. My requirement is to set up a daily integration that checks for new employees in Workday and adds them to the SharePoint list. Additionally, the integration should identify any changes to existing employee records and update the SharePoint list accordingly.&lt;/P&gt;&lt;P&gt;What is the recommended way to achieve it without using Foreach loop?&lt;/P&gt;&lt;P&gt;JSON1=[&lt;BR /&gt;{&lt;BR /&gt;"lastName": "Smith",&lt;BR /&gt;"User_Name": "jsmith1",&lt;BR /&gt;"Email_-_Work": "jsmith@example.com",&lt;BR /&gt;"Company": "TechCorp",&lt;BR /&gt;"Position": "Developer",&lt;BR /&gt;"Legal_Last_Name": "Smith",&lt;BR /&gt;"Employee_ID": "12345"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"lastName": "Smith",&lt;BR /&gt;"User_Name": "jsmith2",&lt;BR /&gt;"Email_-_Work": "jsmith@example.com",&lt;BR /&gt;"Company": "TechCorp2",&lt;BR /&gt;"Position": "Developer",&lt;BR /&gt;"Legal_Last_Name": "Smith",&lt;BR /&gt;"Employee_ID": "12345"&lt;BR /&gt;}&lt;BR /&gt;{&lt;BR /&gt;"lastName": "Smith",&lt;BR /&gt;"User_Name": "jsmith3",&lt;BR /&gt;"Email_-_Work": "jsmith@example.com",&lt;BR /&gt;"Company": "TechCorp",&lt;BR /&gt;"Position": "Developer",&lt;BR /&gt;"Legal_Last_Name": "Smith",&lt;BR /&gt;"Employee_ID": "12345"&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;JSON2=[&lt;BR /&gt;{&lt;BR /&gt;"lastName": "Smith",&lt;BR /&gt;"User_Name": "jsmith1",&lt;BR /&gt;"Email_-_Work": "jsmith@example.com",&lt;BR /&gt;"Company": "TechCorp",&lt;BR /&gt;"Position": "Developer",&lt;BR /&gt;"Legal_Last_Name": "Smith",&lt;BR /&gt;"Employee_ID": "12345",&lt;BR /&gt;"ID": "1"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"lastName": "Smith",&lt;BR /&gt;"User_Name": "jsmith2",&lt;BR /&gt;"Email_-_Work": "jsmith@example.com",&lt;BR /&gt;"Company": "TechCorp3",&lt;BR /&gt;"Position": "Developer",&lt;BR /&gt;"Legal_Last_Name": "Smith",&lt;BR /&gt;"Employee_ID": "12345",&lt;BR /&gt;"ID": "2"&lt;BR /&gt;}&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;JSON1 is my main data source which should synced with SharePoint list, once we identify the changes, we can update/create in the SharePoint list, please note that SharePoint will have the extra column called "ID" which needs to be ignored when matching as this column is needed to update in SharePoint.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any suggestions are highly appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 13:10:34 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8375#M3506</guid>
      <dc:creator>ankuragarawal</dc:creator>
      <dc:date>2024-12-23T13:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Json arrays to find the new and updated records</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8376#M3507</link>
      <description>&lt;P&gt;Hi Ankur,&lt;BR /&gt;Did you try this trigger option&amp;nbsp;&lt;A href="https://docs.workato.com/connectors/workday/new_updated_object.html" target="_blank"&gt;https://docs.workato.com/connectors/workday/new_updated_object.html&lt;/A&gt;.&lt;BR /&gt;This trigger picks each record whenever it is either created or updated.&lt;BR /&gt;PS: This is not a batch option.&lt;BR /&gt;Regards,&lt;BR /&gt;Prudvi&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 13:20:10 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8376#M3507</guid>
      <dc:creator>Prudvi</dc:creator>
      <dc:date>2024-12-23T13:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Json arrays to find the new and updated records</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8378#M3509</link>
      <description>&lt;P&gt;you need to use Python script to compare the records and pick unique records.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 13:52:50 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8378#M3509</guid>
      <dc:creator>nitishjain</dc:creator>
      <dc:date>2024-12-23T13:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Json arrays to find the new and updated records</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8380#M3510</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://systematic.workato.com/t5/user/viewprofilepage/user-id/11353"&gt;@ankuragarawal&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;STRONG&gt;Assumptions&lt;/STRONG&gt;: with the above requirements, you able to fetch the records from both Workday and Share-point application.&lt;BR /&gt;&lt;STRONG&gt;Problem statement&lt;/STRONG&gt;: You need a help in comparing two output response of both the application (Workday and Share-point)&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Solution&lt;/STRONG&gt;:&amp;nbsp; Pass the both the response as input to the Python component and where create two list&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1. &lt;STRONG&gt;Create_list&lt;/STRONG&gt;: To create new records in&amp;nbsp; Share-point&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2. &lt;STRONG&gt;Update_list&lt;/STRONG&gt;: To update the existing records in Share-point&lt;BR /&gt;&lt;BR /&gt;Feel free to reach out if you need any further assistance.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Python code.PNG" style="width: 574px;"&gt;&lt;img src="https://systematic.workato.com/t5/image/serverpage/image-id/1712i3D5D429D666B52B6/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="Python code.PNG" alt="Python code.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;BR /&gt;Shivakumara A&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 15:29:54 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8380#M3510</guid>
      <dc:creator>shivakumara</dc:creator>
      <dc:date>2024-12-23T15:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Json arrays to find the new and updated records</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8385#M3513</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;Thank you all for your responses. I was looking for a built-in way to implement this without using any scripting language, but it seems that using Python or JavaScript is the way forward.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I tested a script to identify changed or new records, and it works with Workato. However, the challenge lies in making the data dynamic. Currently, it requires some manual steps to map the list datapill to the input fields of the Python action in Workato. It would be helpful to have examples demonstrating how to pass list data to the input of a Python action.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Script for the solution:&lt;/P&gt;&lt;P&gt;def main(input):&lt;BR /&gt;list1 = [&lt;BR /&gt;{&lt;BR /&gt;"Last name": "User1",&lt;BR /&gt;"User name": "eu111",&lt;BR /&gt;"Email - work": "User1@test.com",&lt;BR /&gt;"Company": "Company1",&lt;BR /&gt;"Position": "Team Leader",&lt;BR /&gt;"Employee ID": "111",&lt;BR /&gt;"First name": "Test",&lt;BR /&gt;"Department": "IT"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"Last name": "User2",&lt;BR /&gt;"User name": "eu112",&lt;BR /&gt;"Email - work": "User2@test.com",&lt;BR /&gt;"Company": "Company1",&lt;BR /&gt;"Position": "Team Leader",&lt;BR /&gt;"Employee ID": "112",&lt;BR /&gt;"First name": "Test",&lt;BR /&gt;"Department": "IT"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"Last name": "User3",&lt;BR /&gt;"User name": "eu113",&lt;BR /&gt;"Email - work": "User3@test.com",&lt;BR /&gt;"Company": "Company1",&lt;BR /&gt;"Position": "Team Leader",&lt;BR /&gt;"Employee ID": "113",&lt;BR /&gt;"First name": "Test",&lt;BR /&gt;"Department": "IT"&lt;BR /&gt;}&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;list2 = [&lt;BR /&gt;{&lt;BR /&gt;"Last name": "User1",&lt;BR /&gt;"User name": "eu111",&lt;BR /&gt;"Email - work": "User1@test.com",&lt;BR /&gt;"Company": "Company1",&lt;BR /&gt;"Position": "Team Leader1",&lt;BR /&gt;"Employee ID": "111",&lt;BR /&gt;"First name": "Test",&lt;BR /&gt;"Department": "IT",&lt;BR /&gt;"ID": 1&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"Last name": "User2",&lt;BR /&gt;"User name": "eu112",&lt;BR /&gt;"Email - work": "User2@test.com",&lt;BR /&gt;"Company": "Company1",&lt;BR /&gt;"Position": "Team Leader",&lt;BR /&gt;"Employee ID": "112",&lt;BR /&gt;"First name": "Test",&lt;BR /&gt;"Department": "IT",&lt;BR /&gt;"ID": 2&lt;BR /&gt;}&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;# Function to remove the 'ID' field from each record&lt;BR /&gt;def remove_id_field(data):&lt;BR /&gt;return [{key: value for key, value in record.items() if key != "ID"} for record in data]&lt;/P&gt;&lt;P&gt;# Clean list2 by removing the 'ID' field&lt;BR /&gt;list2_cleaned = remove_id_field(list2)&lt;/P&gt;&lt;P&gt;# Find changed records (same Employee ID but differing other fields)&lt;BR /&gt;changed_records = []&lt;BR /&gt;list1_without_changes = []&lt;BR /&gt;for record1 in list1:&lt;BR /&gt;is_changed = False&lt;BR /&gt;for record2 in list2_cleaned:&lt;BR /&gt;if record1.get("Employee ID") == record2.get("Employee ID"):&lt;BR /&gt;if record1 != record2:&lt;BR /&gt;changed_records.append(record2)&lt;BR /&gt;is_changed = True&lt;BR /&gt;break&lt;BR /&gt;if not is_changed:&lt;BR /&gt;list1_without_changes.append(record1)&lt;/P&gt;&lt;P&gt;# Find new records (present in list1 but not in list2)&lt;BR /&gt;new_records = [record for record in list1_without_changes if record not in list2_cleaned]&lt;/P&gt;&lt;P&gt;return {&lt;BR /&gt;"new_records": new_records,&lt;BR /&gt;"changed_records": changed_records,&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2024 10:40:37 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8385#M3513</guid>
      <dc:creator>ankuragarawal</dc:creator>
      <dc:date>2024-12-24T10:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Json arrays to find the new and updated records</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8973#M3701</link>
      <description>&lt;P&gt;Both requests result in List datapills. Why not load them into two SQL Collections then just use SQL joins/queries with the two SQL collections to get the resulting List, then use that resulting List datapill to update/insert into the SharePoint list?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 03:53:01 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/compare-two-json-arrays-to-find-the-new-and-updated-records/m-p/8973#M3701</guid>
      <dc:creator>blakesha</dc:creator>
      <dc:date>2025-02-25T03:53:01Z</dc:date>
    </item>
  </channel>
</rss>

