<?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 Query Question in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-question/m-p/284998#M7430</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have seen a couple apps that have radio buttons/check boxes in a TOC...where the user selects a few and it queries some data source and returns the recrods that pertain to those selected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://gis.anokacountymn.gov/go-anoka/"&gt;http://gis.anokacountymn.gov/go-anoka/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I assume that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There is a field for each in a feature class (say a parcels data source), boolean?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;then the user selects the radio buttons/check boxes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A query is then built search for recods with all the selected radio buttons/check boxes that were selected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this how soemthing like that is done....I am somewhat confident I can get the final query built...WHERE A AND B AND C AND D&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But am having a hard time with the querying what radio buttons are clicked to build the query&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If RadioButtonA Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Else if RadioButtonB Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Etc etc&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts would be greatly apprecited?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Mar 2011 16:24:34 GMT</pubDate>
    <dc:creator>JayKappy</dc:creator>
    <dc:date>2011-03-02T16:24:34Z</dc:date>
    <item>
      <title>Query Question</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-question/m-p/284998#M7430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have seen a couple apps that have radio buttons/check boxes in a TOC...where the user selects a few and it queries some data source and returns the recrods that pertain to those selected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://gis.anokacountymn.gov/go-anoka/"&gt;http://gis.anokacountymn.gov/go-anoka/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I assume that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There is a field for each in a feature class (say a parcels data source), boolean?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;then the user selects the radio buttons/check boxes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A query is then built search for recods with all the selected radio buttons/check boxes that were selected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this how soemthing like that is done....I am somewhat confident I can get the final query built...WHERE A AND B AND C AND D&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But am having a hard time with the querying what radio buttons are clicked to build the query&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If RadioButtonA Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Else if RadioButtonB Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Etc etc&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts would be greatly apprecited?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2011 16:24:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-question/m-p/284998#M7430</guid>
      <dc:creator>JayKappy</dc:creator>
      <dc:date>2011-03-02T16:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Query Question</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-question/m-p/284999#M7431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So the question is, how to identify which radio button is clicked?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can look at this SDK sample: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SwitchMap" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SwitchMap&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The radio buttons in the sample above is used to switch base layer url. Notice that all radio button use the same RadioButton_Click event. In XAML, notice also that RadioButton.Tag is used to hold the url. Another way is to check by instance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
RadioButton rb = sender as RadioButton
if(rb == this.StreetsRadioButton){}
else if(rb == this.TopoRadioButton){}
else{}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:47:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-question/m-p/284999#M7431</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-11T13:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Query Question</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-question/m-p/285000#M7432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I might have misspoke...in the example I gave they were actually Check boxes...the users selects a few check boxes in the "What activity do you want to do" and it seems to be quering a feature class....I assume that the feature class has a field for each activity....the query is built to find each records that has the checked values...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am just unclear how to create that query...lots of AND statements?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But imagin there has to be some sort of loop, else statement to first determine which are checked.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2011 18:48:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-question/m-p/285000#M7432</guid>
      <dc:creator>JayKappy</dc:creator>
      <dc:date>2011-03-02T18:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Query Question</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-question/m-p/285001#M7433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can use StringBuilder to build the Where clause and Dictionary to hold the field name and value pair.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can change the equality sign as you wish too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
StringBuilder sb = new StringBuilder();
int count = 0;
foreach (var item in items)
{&amp;nbsp;&amp;nbsp;&amp;nbsp; 
 if(count == 0)
&amp;nbsp; sb.Append(string.Format("{0} &amp;gt; {1}", item.Key, item.Value));
 else
&amp;nbsp; sb.Append(string.Format(" and {0} &amp;gt; {1}", item.Key, item.Value));
 count++;
}
query.Where = sb.ToString();
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The following code assumes that each CheckBox Content is the field name, each field accepts an integer value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
private Dictionary&amp;lt;string, int&amp;gt; items = new Dictionary&amp;lt;string, int&amp;gt;();
private void CheckBox_Click(object sender, RoutedEventArgs e)
{
 CheckBox cb = sender as CheckBox;
 string key = (string) cb.Content;
 if (items.ContainsKey(key))
&amp;nbsp; items.Remove(key);
 else
&amp;nbsp; items.Add(key, Convert.ToInt32(NumValue.Text.Trim()));
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:47:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/query-question/m-p/285001#M7433</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-11T13:47:07Z</dc:date>
    </item>
  </channel>
</rss>

