<?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: A Simple Query of a FeatureClass (Help Please) in ArcGIS for Windows Mobile Questions</title>
    <link>https://community.esri.com/t5/arcgis-for-windows-mobile-questions/a-simple-query-of-a-featureclass-help-please/m-p/283857#M1297</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey- glad you figured it out. But I am putting a code snippet anyway for others to see- and this shows getting the geometry and another way to get access to data values for all records in the layer. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And the only reason I know to call Read() because of working with datareaders for calls directly to database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;FeatureDataReader featDataReader = featureLayer.GetDataReader(new QueryFilter());
while (featDataReader.Read())
{
 String theName = featDataReader["Name"].ToString(); //you can use column index or column name
 Geometry m_geometry = featDataReader[featDataReader.GeometryColumnIndex] as Geometry;
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 13:44:10 GMT</pubDate>
    <dc:creator>MelindaFrost</dc:creator>
    <dc:date>2021-12-11T13:44:10Z</dc:date>
    <item>
      <title>A Simple Query of a FeatureClass (Help Please)</title>
      <link>https://community.esri.com/t5/arcgis-for-windows-mobile-questions/a-simple-query-of-a-featureclass-help-please/m-p/283853#M1293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to simply query a featureclass in the mobile cache.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to retrieve the record where TEAM_ID = Team A.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I select that record, I want to get the value of a particular field and store it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please help me, here is some sample code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
FeatureLayer featureLayer = MobileApplication.Current.Project.FindFeatureLayer("Field Crew Teams");
&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;&amp;nbsp;&amp;nbsp; 
QueryFilter pQFilter;
string whereClause = "TEAM_ID = Team A";
pQFilter = new QueryFilter(whereClause, true);&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;&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;&amp;nbsp; 
FeatureDataReader featDataReader = featureLayer.GetDataReader(pQFilter);

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code is also stating that QueryFilter is obsolete, so I am also trying to use QueryDefinition but I don't know which reference I am suppose to add.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please help me out,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Akhil P.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Sep 2010 15:06:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-for-windows-mobile-questions/a-simple-query-of-a-featureclass-help-please/m-p/283853#M1293</guid>
      <dc:creator>AkhilParujanwala</dc:creator>
      <dc:date>2010-09-29T15:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: A Simple Query of a FeatureClass (Help Please)</title>
      <link>https://community.esri.com/t5/arcgis-for-windows-mobile-questions/a-simple-query-of-a-featureclass-help-please/m-p/283854#M1294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try using single quotes around the value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;string whereClause = "TEAM_ID = 'Team A'";&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Sep 2010 13:46:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-for-windows-mobile-questions/a-simple-query-of-a-featureclass-help-please/m-p/283854#M1294</guid>
      <dc:creator>MelindaFrost</dc:creator>
      <dc:date>2010-09-30T13:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: A Simple Query of a FeatureClass (Help Please)</title>
      <link>https://community.esri.com/t5/arcgis-for-windows-mobile-questions/a-simple-query-of-a-featureclass-help-please/m-p/283855#M1295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks buddha the apostrophe's allowed the QueryFilter to work, but now I am having problems trying to create a cursor for the selected row and then I want to extract a value from a particular column.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
FeatureLayer featureLayer = MobileApplication.Current.Project.FindFeatureLayer("Field Crew Teams");

string whereClause = "[TEAM_ID] = 'Team A'";
QueryFilter pQFilter = new QueryFilter();
pQFilter.WhereClause = whereClause;

FeatureDataTable fDataTable = featureLayer.GetDataTable(pQFilter);
OR
FeatureDataReader fdreader = featureLayer.GetDataReader(pQFilter);

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As you can see I can use either but after that I can't get access selected row and then find out the value of a particular column.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am able to count the number of columns in my Layer, aslo able to get the index position of the column I want, but I cant figure out how to proceed from here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Akhil P.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:44:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-for-windows-mobile-questions/a-simple-query-of-a-featureclass-help-please/m-p/283855#M1295</guid>
      <dc:creator>AkhilParujanwala</dc:creator>
      <dc:date>2021-12-11T13:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: A Simple Query of a FeatureClass (Help Please)</title>
      <link>https://community.esri.com/t5/arcgis-for-windows-mobile-questions/a-simple-query-of-a-featureclass-help-please/m-p/283856#M1296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok, I got even further with this but I am unable to extract the value from a particular column, it just gives me an error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
FeatureLayer featureLayer = MobileApplication.Current.Project.FindFeatureLayer("Field Crew Teams");

string user = m_signInExtension.UserID;
string whereClause = "UserID = " + "'" + user + "'";
ESRI.ArcGIS.Mobile.Client.Windows.MessageBox.ShowDialog("Query String is " + whereClause); //just making sure the query is correct
QueryFilter pQFilter = new QueryFilter();
pQFilter.WhereClause = whereClause;

FeatureDataTable fDataTable = featureLayer.GetDataTable(pQFilter);
fDataTable = featureLayer.GetDataTable();

int columnNameIndex = fDataTable.Columns.IndexOf("UserID");
int featureCount = featureLayer.GetFeatureCount(pQFilter);
ESRI.ArcGIS.Mobile.Client.Windows.MessageBox.ShowDialog("Feature Count = " + Convert.ToString(featureCount));&amp;nbsp; //value returned is 1, which is correct

FeatureDataReader fDataReader = featureLayer.GetDataReader(pQFilter);
ESRI.ArcGIS.Mobile.Client.Windows.MessageBox.ShowDialog(fDataReader.GetDataTypeName(columnNameIndex)); //this does work, it gives me "String", which is correct

fDataReader.Read; //THIS MUST BE DONE BEFORE TRYING TO READ THE TABLE, finally figured it out!
string userIs = fDataReader.GetString(columnNameIndex).ToString; //Error!&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ++ Added .ToString at the end&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
ESRI.ArcGIS.Mobile.Client.Windows.MessageBox.ShowDialog("The user is = " + userIs); //this doesn't show up because of the error above

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried GetValue also but that will only return an Int. But even then, I tested it on an Int field and it still wouldn't retrieve the value from the field. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For some reason I won't run this line "string userIs = fDataReader.GetString(columnNameIndex); //Error!"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: Figured it out, you must put fDataReader.Read before tryingto read the table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;----Once again thanks buddha for the queryfilter and ESRI documentation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Akhil P.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:44:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-for-windows-mobile-questions/a-simple-query-of-a-featureclass-help-please/m-p/283856#M1296</guid>
      <dc:creator>AkhilParujanwala</dc:creator>
      <dc:date>2021-12-11T13:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: A Simple Query of a FeatureClass (Help Please)</title>
      <link>https://community.esri.com/t5/arcgis-for-windows-mobile-questions/a-simple-query-of-a-featureclass-help-please/m-p/283857#M1297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey- glad you figured it out. But I am putting a code snippet anyway for others to see- and this shows getting the geometry and another way to get access to data values for all records in the layer. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And the only reason I know to call Read() because of working with datareaders for calls directly to database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;FeatureDataReader featDataReader = featureLayer.GetDataReader(new QueryFilter());
while (featDataReader.Read())
{
 String theName = featDataReader["Name"].ToString(); //you can use column index or column name
 Geometry m_geometry = featDataReader[featDataReader.GeometryColumnIndex] as Geometry;
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:44:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-for-windows-mobile-questions/a-simple-query-of-a-featureclass-help-please/m-p/283857#M1297</guid>
      <dc:creator>MelindaFrost</dc:creator>
      <dc:date>2021-12-11T13:44:10Z</dc:date>
    </item>
  </channel>
</rss>

