<?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 Hi David,
Unfortunately, I… in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63804#M16686</link>
    <description>Hi David,
Unfortunately, I am attempting to merge two collections with different columns/rows, i.e.:
Table 1
ID / Name / Age
AL55W / John / 21
AL89R / James / 30
AL64W / Jack / 45
Table 2
ID / Orders / Frequency
AL55W / 50 / Weekly
AL89R / 75 / Weekly
AL64W / 100 / Monthly
Both collections contain the column ""ID"", but each collection contains different data in all other columns. Effectively, I'm looking to merge these collections based on the ""ID"" column without resorting to looping through 1000+ lines on each collection as it's taking far too long. Also, sometimes Table 2 will not have the ""ID"" values from Table 1, so these would either need to be removed or returned with blank values in the joined columns.&amp;nbsp;
Thanks for taking the time to respond.
Chris</description>
    <pubDate>Thu, 31 Jan 2019 16:49:00 GMT</pubDate>
    <dc:creator>ChrisHodgson1</dc:creator>
    <dc:date>2019-01-31T16:49:00Z</dc:date>
    <item>
      <title>Merge Collections based on Key Field</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63801#M16683</link>
      <description>Hi,

I'm looking to merge two collections with different columns that have one column with data that will match between them.

Looping through both into a new collection does work, but takes far too long with collections that have 1000+ lines.

Is there a way of merging them in a way similar to a SQL "Join" query? If so, does anybody have any example code?

Thanks in advance,

Chris</description>
      <pubDate>Wed, 30 Jan 2019 16:09:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63801#M16683</guid>
      <dc:creator>ChrisHodgson1</dc:creator>
      <dc:date>2019-01-30T16:09:00Z</dc:date>
    </item>
    <item>
      <title>Hi Chris,
Are you sure …</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63802#M16684</link>
      <description>Hi Chris,
Are you sure 'Merge Collection' isn't what you need?
Of course, you'd need to remove/delete the key column from one of the collections before the merge or perhaps rename it.
As long as both collections have the same number of rows and exactly the same keys, then it will work just fine. You may want to do some kind of validation afterward to sanity check it.
If you're saying that the columns do not have the same rows, in that one has keys that the other does not have, then what I'm suggesting isn't what you need.
Respectfully,
Dave</description>
      <pubDate>Wed, 30 Jan 2019 23:25:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63802#M16684</guid>
      <dc:creator>david.l.morris</dc:creator>
      <dc:date>2019-01-30T23:25:00Z</dc:date>
    </item>
    <item>
      <title>I forgot to mention you'd…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63803#M16685</link>
      <description>I forgot to mention you'd need to sort both collections on their key columns before merging as well.</description>
      <pubDate>Wed, 30 Jan 2019 23:28:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63803#M16685</guid>
      <dc:creator>david.l.morris</dc:creator>
      <dc:date>2019-01-30T23:28:00Z</dc:date>
    </item>
    <item>
      <title>Hi David,
Unfortunately, I…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63804#M16686</link>
      <description>Hi David,
Unfortunately, I am attempting to merge two collections with different columns/rows, i.e.:
Table 1
ID / Name / Age
AL55W / John / 21
AL89R / James / 30
AL64W / Jack / 45
Table 2
ID / Orders / Frequency
AL55W / 50 / Weekly
AL89R / 75 / Weekly
AL64W / 100 / Monthly
Both collections contain the column ""ID"", but each collection contains different data in all other columns. Effectively, I'm looking to merge these collections based on the ""ID"" column without resorting to looping through 1000+ lines on each collection as it's taking far too long. Also, sometimes Table 2 will not have the ""ID"" values from Table 1, so these would either need to be removed or returned with blank values in the joined columns.&amp;nbsp;
Thanks for taking the time to respond.
Chris</description>
      <pubDate>Thu, 31 Jan 2019 16:49:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63804#M16686</guid>
      <dc:creator>ChrisHodgson1</dc:creator>
      <dc:date>2019-01-31T16:49:00Z</dc:date>
    </item>
    <item>
      <title>Hi Chris,
I see what you…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63805#M16687</link>
      <description>Hi Chris,
I see what you mean. I couldn't tell from the original post whether it was the same number of rows in each collection.
You may be aware of this already, but I wanted to mention to completely ignore the processing time while in DEBUG mode (Process/Object Studio). It is significantly slower than in Control Room.
I did a 'quick' test where I operated on 1500 rows, and it took 4 minutes in Control Room. That's not even accounting for the nested loop I imagine you'd need in your use case.
Maybe LINQ is what you need in a code stage, since that's like SQL, and I imagine it's optimized for this kind of thing.
Dave</description>
      <pubDate>Thu, 31 Jan 2019 18:58:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63805#M16687</guid>
      <dc:creator>david.l.morris</dc:creator>
      <dc:date>2019-01-31T18:58:00Z</dc:date>
    </item>
    <item>
      <title>Hi David,
We've tried in…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63806#M16688</link>
      <description>Hi David,
We've tried in Control Room also. You're correct that it's a lot faster, but our tables are increasingly large so this seems to get slower over time.
I will look into LINQ as that may help.
Thanks,
Chris</description>
      <pubDate>Thu, 31 Jan 2019 19:47:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63806#M16688</guid>
      <dc:creator>ChrisHodgson1</dc:creator>
      <dc:date>2019-01-31T19:47:00Z</dc:date>
    </item>
    <item>
      <title>Hi Chris,
Please give a try…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63807#M16689</link>
      <description>Hi Chris,
Please give a try with OLEDB VBO. It should help you join the tables based on ID.
&amp;nbsp;
Abhishek</description>
      <pubDate>Sun, 03 Feb 2019 11:01:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63807#M16689</guid>
      <dc:creator>AbhishekKV</dc:creator>
      <dc:date>2019-02-03T11:01:00Z</dc:date>
    </item>
    <item>
      <title>The only issue with OLEDB is…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63808#M16690</link>
      <description>The only issue with OLEDB is that it's expecting you to connect to a source outside of BP. I suppose it could still be faster to write both tables to Excel and then query them both to join on ID. But at that point, why not just get someone to write a reusable action using VB/C# code?</description>
      <pubDate>Sun, 03 Feb 2019 21:18:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63808#M16690</guid>
      <dc:creator>david.l.morris</dc:creator>
      <dc:date>2019-02-03T21:18:00Z</dc:date>
    </item>
    <item>
      <title>HI Chris,
I managed to…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63809#M16691</link>
      <description>HI Chris,
I managed to acheive this recently by using a .net code stage.
I added the collections to a data set,
Created a data relation for the data set.
Then loop throughed&amp;nbsp;""collection&amp;nbsp;1""&amp;nbsp;finding its children and added data to the row.
I can post the code if you require.
Regards</description>
      <pubDate>Tue, 19 Mar 2019 16:07:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63809#M16691</guid>
      <dc:creator>StuartRedmore</dc:creator>
      <dc:date>2019-03-19T16:07:00Z</dc:date>
    </item>
    <item>
      <title>Hi Stuart,
That sounds like…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63810#M16692</link>
      <description>Hi Stuart,
That sounds like it could be useful. I'd love to have a look at it if you don't mind posting the code.
Thanks for your response.
Chris</description>
      <pubDate>Tue, 02 Apr 2019 18:26:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63810#M16692</guid>
      <dc:creator>ChrisHodgson1</dc:creator>
      <dc:date>2019-04-02T18:26:00Z</dc:date>
    </item>
    <item>
      <title>Hi Chris, I have attached it…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63811#M16693</link>
      <description>Hi Chris, I have attached it.
The parameters are:
In : Collection_One - Datatable
In : Field_One_Name - String
In : Collection_two - Datatable
In : Field_Two_Name - String
Out : Collection_Out - Datatable
Out : DataTableLen - Decimal
Naturally Datatables are the collections.
The code I've written is basically the form of ""Left join"" , but it wouldn't be difficult to change to an inner join if that's what you needed.
It only works on a single column to column relationship, these being Field_One_Name ( this must exist in Collection_One ), and Field_Two_Name ( this must exist in Collection_Two ).&amp;nbsp; but again it wouldn't take much work to expand this.
You can ignore / remove the DataTableLen item from the code and output, I added it whilst debugging and simply forgot to remove it.
Please let me know if i can help further.
&amp;nbsp;</description>
      <pubDate>Wed, 03 Apr 2019 15:35:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63811#M16693</guid>
      <dc:creator>StuartRedmore</dc:creator>
      <dc:date>2019-04-03T15:35:00Z</dc:date>
    </item>
    <item>
      <title>Hi Stuart,
That object…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63812#M16694</link>
      <description>Hi Stuart,
That object worked perfectly!
Thank you very much for your help I really appreciate it.
Chris</description>
      <pubDate>Wed, 03 Apr 2019 16:11:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63812#M16694</guid>
      <dc:creator>ChrisHodgson1</dc:creator>
      <dc:date>2019-04-03T16:11:00Z</dc:date>
    </item>
    <item>
      <title>RE: Hi Stuart,
That object…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63813#M16695</link>
      <description>Can you pls help me with the same code as well&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Saumya Sinha&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Dec 2021 13:58:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-Collections-based-on-Key-Field/m-p/63813#M16695</guid>
      <dc:creator>SaumyaSinha2</dc:creator>
      <dc:date>2021-12-06T13:58:00Z</dc:date>
    </item>
  </channel>
</rss>

