Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am displaying almost 9000 records by four type (A,B,C & D) in which I am displaying records using combo-box.

Each record is classified by "ctype" ( A or B or C or D) so I am putting this in combo so that If I select type A then all records of type A will be display..

Code that I am following :

Code link : http://jsfiddle.net/sunilspalkar/hdmNx/1/

In above code all records displaying but its not showing unique records of dam . I am facing same problem..

What I tried :

1.I am using query layer & I can not use "distinct" because of "geom" column . 2.I searched the API reference also for "unique elements for combo-box" but I did not found suitable material. 3. I found this link In this link values are hard coded and I have dynamic values. 4. If I use "STATE" column instead of "ctype" then it works fine.. the "ctype" column has string type and all records are well formatted..

Any help will be great..thanks in advance : )

Software's : Sql Server 2008 r2 (for query layer) , ArcGIS Server/Desktop 10.1 , Java script API ver. 3.0/3.1

share|improve this question
    
Also checked the "query task API reference" for version 3.0/3.1 –  Sunil Dec 6 '12 at 6:22
    
Hello All..this may be irrelevant but how many query layers can I use in ArcMap ? At present I am using two but I am unable to publish two query layers in ArcGIS Server 10.1 –  Sunil Dec 6 '12 at 10:18

1 Answer 1

up vote 2 down vote accepted

I assume you want the list to show a list of unique dam values? You need to filter your array to get them. Here is a fiddle http://jsfiddle.net/dave_wilton/hdmNx/6/

It assumes you are using name to filter on:

    function cleanFilterValues(values) {
      var unique = {};
      //get rid of duplicates
      return dojo.filter(values, function(value) {
             if (!unique[value.name]) {
             unique[value.name] = true;
             return true;
       }
     return false;
    });
share|improve this answer
    
thanks for your reply..Yes I want to display unique dam values..I will test and let you know...thanks : ) –  Sunil Dec 6 '12 at 10:26
1  
I've moved your code in to the JS file. Don't put your code in the markup odoe.net/blog/?p=212 –  David Wilton Dec 6 '12 at 10:30
    
Sorry link to updated fiddle jsfiddle.net/dave_wilton/hdmNx/10 –  David Wilton Dec 6 '12 at 10:48
1  
ArcGIS server is limited to returning 1000 records (although it can be changed with caution). You should probably ask this as a separate question but I would suggest looking at using the new statistics class which if used with return geometry = false will return more than 1000. It will also return unique values and get rid of the need for the above code. Requires 10.1 help.arcgis.com/en/webapi/javascript/arcgis/help/… –  David Wilton Dec 6 '12 at 11:29
1  
@Sunil Yes you can change it, but I wouldn't recommend it for what you are doing. Check out the statistics, it will provide much better performance. Returning 9000 geometries = slow. use statistics to get the unique values and in the onChange event use query task to get your geometry –  David Wilton Dec 10 '12 at 9:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.