<?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 What gives with UpdateSearchedRows? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511217#M13787</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using ITable.UpdateSearchedRows and I have a sub field define and my query filter defined so it should only update a&amp;nbsp; single field on a single row within the given table. However, it's replacing all the fields in the row with null values except the defined sub field. Why is it setting all other fields not included in the sub field to null? I was under the impression that this would just update the specified sub field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've included a rough example of my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The where clause doesn't contain the field I'm updating but rather includes the fields to find the row where the totallength&amp;nbsp; should be updated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
ITable tab = GetTable(MyTable);
int totallengthfieldindex = tab.FindField("totallength");
IQueryFilter2 qf2 = new QueryFilterClass();
IRowBuffer buff = tab.CreateRowBuffer();
TotalLength = CalcValue();
qf2.WhereClause = "field = 'myfield' and field2 = " + myfield2 + " and field3 = " + field3value;
qf2.SubFields = "totallength";
buff.set_Value(totallengthfieldindex, TotalLength);
tab.UpdateSearchedRows(qf2, buff);
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Aug 2011 22:20:57 GMT</pubDate>
    <dc:creator>GregRieck</dc:creator>
    <dc:date>2011-08-03T22:20:57Z</dc:date>
    <item>
      <title>What gives with UpdateSearchedRows?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511217#M13787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using ITable.UpdateSearchedRows and I have a sub field define and my query filter defined so it should only update a&amp;nbsp; single field on a single row within the given table. However, it's replacing all the fields in the row with null values except the defined sub field. Why is it setting all other fields not included in the sub field to null? I was under the impression that this would just update the specified sub field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've included a rough example of my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The where clause doesn't contain the field I'm updating but rather includes the fields to find the row where the totallength&amp;nbsp; should be updated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
ITable tab = GetTable(MyTable);
int totallengthfieldindex = tab.FindField("totallength");
IQueryFilter2 qf2 = new QueryFilterClass();
IRowBuffer buff = tab.CreateRowBuffer();
TotalLength = CalcValue();
qf2.WhereClause = "field = 'myfield' and field2 = " + myfield2 + " and field3 = " + field3value;
qf2.SubFields = "totallength";
buff.set_Value(totallengthfieldindex, TotalLength);
tab.UpdateSearchedRows(qf2, buff);
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2011 22:20:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511217#M13787</guid>
      <dc:creator>GregRieck</dc:creator>
      <dc:date>2011-08-03T22:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: What gives with UpdateSearchedRows?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511218#M13788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm short with time but SDK states that...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ITable.UpdateSearchedRows description:&lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/ITable_UpdateSearchedRows.htm"&gt; &lt;BR /&gt;&lt;/A&gt;&lt;SPAN&gt;This method will edit the rows matching the query filter's constraints.&amp;nbsp; The&amp;nbsp; values in each row will be replaced with the corresponding field's value in the&amp;nbsp; provided row buffer.&amp;nbsp; The fields being edited should be specified in the query&amp;nbsp; filter's SubFields property.&amp;nbsp; If the row buffer contains null values, and the&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt;SubFields property is not properly set&lt;/STRONG&gt;&lt;SPAN&gt;, the row's values will be overwritten&amp;nbsp; with the row buffer's null values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't see &lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;buff.set_Value(index, value);&lt;/PRE&gt;&lt;SPAN style="font-size:2;"&gt; in your code but i see &lt;/SPAN&gt;&lt;SPAN&gt;set_Value&lt;/SPAN&gt;&lt;SPAN style="font-size:2;"&gt; for &lt;/SPAN&gt;&lt;SPAN&gt;slbuff, maybe you had mistyped.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this can help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regards Dubravko Antoni�?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Aug 2011 00:32:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511218#M13788</guid>
      <dc:creator>DubravkoAntonic</dc:creator>
      <dc:date>2011-08-04T00:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: What gives with UpdateSearchedRows?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511219#M13789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, my sample code was incorrect. I've made an update to the sample code. However, that wasn't the problem. I read some of the old forum threads on this topic and found it to be a long standing issue. I've changed my update routine completely and it is working now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;G&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Aug 2011 02:36:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511219#M13789</guid>
      <dc:creator>GregRieck</dc:creator>
      <dc:date>2011-08-04T02:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: What gives with UpdateSearchedRows?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511220#M13790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Any chance someone could post information about what alternative they used? we too are running into issues where trying to update a single field, following all the documentation info, results in ALL fields being set to null.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We are using 10.1 Beta2 and were hoping this was not a beta issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Eric.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 19:30:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511220#M13790</guid>
      <dc:creator>ericliprandi</dc:creator>
      <dc:date>2012-02-14T19:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: What gives with UpdateSearchedRows?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511221#M13791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Any chance someone could post information about what alternative they used? we too are running into issues where trying to update a single field, following all the documentation info, results in ALL fields being set to null.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We are using 10.1 Beta2 and were hoping this was not a beta issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Eric.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 19:46:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511221#M13791</guid>
      <dc:creator>ericliprandi</dc:creator>
      <dc:date>2012-02-14T19:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: What gives with UpdateSearchedRows?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511222#M13792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Eric,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've pretty much stuck with calling row.store() or using an update cursor. I've followed these &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/d/0001000002rs000000.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;examples&lt;/A&gt;&lt;SPAN&gt; with the exception of the UpdateSearchedRows option, never had good results with it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
// Create a ComReleaser for cursor management.
 using(ComReleaser comReleaser = new ComReleaser())
 {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Use ITable.Update to create an update cursor.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ICursor updateCursor = table.Update(null, true);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; comReleaser.ManageLifetime(updateCursor);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Find the positions of the fields used to get and set values.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int firstNameIndex = table.FindField("FirstName");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int lastNameIndex = table.FindField("LastName"); 
&amp;nbsp;&amp;nbsp;&amp;nbsp; int emailIndex = table.FindField("Email");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IRow row = null;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ((row = updateCursor.NextRow()) != null)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the first and last names.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String firstName = Convert.ToString(row.get_Value(firstNameIndex)); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String lastName = Convert.ToString(row.get_Value(lastNameIndex)); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Append the first letter of the first name and the entire last name with 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // an "at" symbol and the email domain to make an email address. 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String emailAddress = String.Concat(firstName[0], lastName, "@MyCompanyName.com"); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.set_Value(emailIndex, emailAddress);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateCursor.UpdateRow(row);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
 }
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;G&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:22:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/what-gives-with-updatesearchedrows/m-p/511222#M13792</guid>
      <dc:creator>GregRieck</dc:creator>
      <dc:date>2021-12-11T22:22:35Z</dc:date>
    </item>
  </channel>
</rss>

