I have published a service. I can get data from feature layers but i can not find a way to get information from layers with Type: Table.
If you have a table you can point ServiceFeatureTable to that and use QueryAsync to retrieve the data.
<SPAN class="keyword token">var</SPAN> serviceUri <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"url to the table"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> ServiceFeatureTable requestsFeatureTable <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ServiceFeatureTable</SPAN><SPAN class="punctuation token">(</SPAN>serviceUri<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> requestsFeatureTable<SPAN class="punctuation token">.</SPAN>FeatureRequestMode <SPAN class="operator token">=</SPAN> FeatureRequestMode<SPAN class="punctuation token">.</SPAN>OnInteractionCache<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">await</SPAN> requestsFeatureTable<SPAN class="punctuation token">.</SPAN><SPAN class="token function">LoadAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> results <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> requestsFeatureTable<SPAN class="punctuation token">.</SPAN><SPAN class="token function">QueryFeaturesAsync</SPAN><SPAN class="punctuation token">(</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">QueryParameters</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> WhereClause <SPAN class="operator token">=</SPAN> <SPAN class="string token">"1=1"</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN> QueryFeatureFields<SPAN class="punctuation token">.</SPAN>LoadAll<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> firstRequest <SPAN class="operator token">=</SPAN> results<SPAN class="punctuation token">.</SPAN><SPAN class="token function">First</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>
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.