Hello there,
Is there any example on how to use group by in a query for arcgis js api?
I dont see any example on how to do this.
Thanks in advice!
I have this that I have made by myself but it doesnt work, i got an error.
What am i missing?
<SPAN class="keyword token">var</SPAN> qTask <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">QueryTask</SPAN><SPAN class="punctuation token">(</SPAN>layers<SPAN class="punctuation token">.</SPAN><SPAN class="token function">read_repartos</SPAN><SPAN class="punctuation token">(</SPAN>token<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> q <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Query</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> statisticDefinition <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">StatisticDefinition</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> statisticDefinition<SPAN class="punctuation token">.</SPAN>statisticType <SPAN class="operator token">=</SPAN> <SPAN class="string token">"count"</SPAN><SPAN class="punctuation token">;</SPAN> statisticDefinition<SPAN class="punctuation token">.</SPAN>onStatisticField <SPAN class="operator token">=</SPAN> <SPAN class="string token">"created_date"</SPAN><SPAN class="punctuation token">;</SPAN> q<SPAN class="punctuation token">.</SPAN>where <SPAN class="operator token">=</SPAN> <SPAN class="string token">"created_user= 'vialactea\\czeballo'"</SPAN><SPAN class="punctuation token">;</SPAN> q<SPAN class="punctuation token">.</SPAN>outFields<SPAN class="operator token">=</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">"*"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN> q<SPAN class="punctuation token">.</SPAN>outStatistics <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN>statisticDefinition<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN> qTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">execute</SPAN><SPAN class="punctuation token">(</SPAN>q<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">(</SPAN>featureSet<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN> console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN>featureSet<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">var</SPAN> us <SPAN class="operator token">=</SPAN> featureSet<SPAN class="punctuation token">.</SPAN>features<SPAN class="punctuation token">.</SPAN><SPAN class="token function">map</SPAN><SPAN class="punctuation token">(</SPAN>u<SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">var</SPAN> ob <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN> key<SPAN class="punctuation token">:</SPAN> u<SPAN class="punctuation token">.</SPAN>attributes<SPAN class="punctuation token">.</SPAN>created_user<SPAN class="punctuation token">,</SPAN> text<SPAN class="punctuation token">:</SPAN> u<SPAN class="punctuation token">.</SPAN>attributes<SPAN class="punctuation token">.</SPAN>created_user<SPAN class="punctuation token">,</SPAN> value<SPAN class="punctuation token">:</SPAN>u<SPAN class="punctuation token">.</SPAN>attributes<SPAN class="punctuation token">.</SPAN>created_user<SPAN class="punctuation token">,</SPAN> content<SPAN class="punctuation token">:</SPAN>u<SPAN class="punctuation token">.</SPAN>attributes<SPAN class="punctuation token">.</SPAN>created_user <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">return</SPAN> ob<SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">return</SPAN> <SPAN class="token function">resolve</SPAN><SPAN class="punctuation token">(</SPAN>us<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">(</SPAN>error<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN> console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN>error<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.