<?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: I want to understand how &amp;quot;Rename Collection Fields&amp;quot; works in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/I-want-to-understand-how-quot-Rename-Collection-Fields-quot/m-p/76123#M28673</link>
    <description>It doesn't really matter what order it renames the columns because it's matching up the column names between the Main_Collection and the New_Headers collection and then using the value in the first row of the New_Headers collection.&lt;BR /&gt;&lt;BR /&gt;It took me a minute, but I think I understand the code in that For Each loop, lol. Here's what I understand it to be doing... (inserting the for each loop for reference)&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE class="language-markup"&gt;		For Each C As DataColumn In Main_Collection.Columns
			Dim NewName As String = Cstr(New_Headers.Rows(0)(C.ColumnName))
			If String.IsNullOrEmpty(NewName) Then
				Throw New ApplicationException("Blank field names are not acceptable")
			Else
				C.ColumnName = Trim(NewName)
			End If
		Next​&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;The loop starts through each column in the Main_Collection. When it starts, it'll have one of the columns, and it starts by creating a variable 'NewName' to hold the new column name temporarily. The Cstr part looks a little confusing. If I explain this wrong, I'm trusting that someone more knowledgeable will correct me. But as I read it, inside the Cstr() parentheses, it is getting the name of the column that has just been retrieved by looping into the column names. the New_Headers.Rows(0) (C.ColumnName) part is getting the ColumnName from the first row (index 0) specifically from the column that has been chosen by the For Each C As DataColumn part of the loop declaration. After that, it just renames C.ColumnName with NewName.&lt;BR /&gt;&lt;BR /&gt;Not sure if I was confusing there, but if you struggled with the same part I did, it was likely the 2-dimensional array/collection part where it does like Rows(0) (C.ColumnName). The (0) part of it is for the rows, and the C part is for the columns. By doing it like that, the code ensures it doesn't matter whether the order of the columns is the same or not.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Dave Morris&lt;BR /&gt;3Ci @ Southern Company&lt;BR /&gt;Atlanta, GA&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Mon, 06 Jan 2020 12:55:00 GMT</pubDate>
    <dc:creator>david.l.morris</dc:creator>
    <dc:date>2020-01-06T12:55:00Z</dc:date>
    <item>
      <title>I want to understand how "Rename Collection Fields" works</title>
      <link>https://community.blueprism.com/t5/Product-Forum/I-want-to-understand-how-quot-Rename-Collection-Fields-quot/m-p/76122#M28672</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Please tell me about the operation of "Rename Collection Fields" of VBO [Collection Manipulation].&lt;BR /&gt;This VBO will generally convert column names correctly, even if I specify the column names in a different order than the order in which they appear.&lt;BR /&gt;&lt;BR /&gt;Microsoft Docs says that For Each ...Next loop does not determine t&lt;SPAN&gt;he order of items in collection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/for-each-next-statement" target="_blank" rel="noopener"&gt;https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/for-each-next-statement&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;How does Blue Prism control the order in which items are retrieved?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Mitsuko &lt;BR /&gt;Asia/Tokyo&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Jan 2020 05:52:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/I-want-to-understand-how-quot-Rename-Collection-Fields-quot/m-p/76122#M28672</guid>
      <dc:creator>sumire</dc:creator>
      <dc:date>2020-01-06T05:52:00Z</dc:date>
    </item>
    <item>
      <title>RE: I want to understand how "Rename Collection Fields" works</title>
      <link>https://community.blueprism.com/t5/Product-Forum/I-want-to-understand-how-quot-Rename-Collection-Fields-quot/m-p/76123#M28673</link>
      <description>It doesn't really matter what order it renames the columns because it's matching up the column names between the Main_Collection and the New_Headers collection and then using the value in the first row of the New_Headers collection.&lt;BR /&gt;&lt;BR /&gt;It took me a minute, but I think I understand the code in that For Each loop, lol. Here's what I understand it to be doing... (inserting the for each loop for reference)&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE class="language-markup"&gt;		For Each C As DataColumn In Main_Collection.Columns
			Dim NewName As String = Cstr(New_Headers.Rows(0)(C.ColumnName))
			If String.IsNullOrEmpty(NewName) Then
				Throw New ApplicationException("Blank field names are not acceptable")
			Else
				C.ColumnName = Trim(NewName)
			End If
		Next​&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;The loop starts through each column in the Main_Collection. When it starts, it'll have one of the columns, and it starts by creating a variable 'NewName' to hold the new column name temporarily. The Cstr part looks a little confusing. If I explain this wrong, I'm trusting that someone more knowledgeable will correct me. But as I read it, inside the Cstr() parentheses, it is getting the name of the column that has just been retrieved by looping into the column names. the New_Headers.Rows(0) (C.ColumnName) part is getting the ColumnName from the first row (index 0) specifically from the column that has been chosen by the For Each C As DataColumn part of the loop declaration. After that, it just renames C.ColumnName with NewName.&lt;BR /&gt;&lt;BR /&gt;Not sure if I was confusing there, but if you struggled with the same part I did, it was likely the 2-dimensional array/collection part where it does like Rows(0) (C.ColumnName). The (0) part of it is for the rows, and the C part is for the columns. By doing it like that, the code ensures it doesn't matter whether the order of the columns is the same or not.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Dave Morris&lt;BR /&gt;3Ci @ Southern Company&lt;BR /&gt;Atlanta, GA&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Jan 2020 12:55:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/I-want-to-understand-how-quot-Rename-Collection-Fields-quot/m-p/76123#M28673</guid>
      <dc:creator>david.l.morris</dc:creator>
      <dc:date>2020-01-06T12:55:00Z</dc:date>
    </item>
    <item>
      <title>RE: I want to understand how "Rename Collection Fields" works</title>
      <link>https://community.blueprism.com/t5/Product-Forum/I-want-to-understand-how-quot-Rename-Collection-Fields-quot/m-p/76124#M28674</link>
      <description>&lt;EM&gt;&amp;gt;&amp;nbsp;&lt;/EM&gt;&lt;SPAN&gt;&lt;EM&gt;it was likely the 2-dimensional array/collection part where it does like Rows(0) (C.ColumnName). The (0) part of it is for the rows, and the C part is for the columns.&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks that is exactly what I am confused.&lt;BR /&gt;Now I understand 'C.ColumnName' determines column and '0' gets new column name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Mitsuko &lt;BR /&gt;Asia/Tokyo&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Jan 2020 00:22:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/I-want-to-understand-how-quot-Rename-Collection-Fields-quot/m-p/76124#M28674</guid>
      <dc:creator>sumire</dc:creator>
      <dc:date>2020-01-07T00:22:00Z</dc:date>
    </item>
  </channel>
</rss>

