I would like to update a feature based on the values from another table. Can I reference other tables using attribute rules and arcade. 'FeatureSets' seems to only refer to referencing other layers in AGOL/Portal.
Thanks!
Xander Bakker ?
Hi T L ,
Interesting question. I don't have much experience with Attribute Rules, but the global variable $datastore is supported in Attribute Rules. However, what I understand from what you posted, you have a table in an Enterprise geodatabase that you want to reference and that doesn't seem to work. Is that correct?
I have a view and I want to update a feature table based on the views changes.
Using arcade and attribute rules you can updated fields based on other fields values, I want to updated another tables field based on a fields value. (in an EGDB)
Seems like I need the equivalent to 'FeatureSets' but in a GDB and not AGO/Portal.
Its doesn't seem to work because I don't know if you can or how to do it.
Hi TLongSUGF ,
If you are not able to locate the table or view using the $datastore, I guess it is not possible. Maybe it is best to create a support case and see if they can confirm this and if so, create an idea to include this in a future version. I'm sorry that I can't be more helpful, since I don't have an environment to reproduce this specific use case.
Looks like I can access other features but I cant get this to work. I am trying update one field (SEEDED) based on another field (seeded_mulched) using the parentrowid and uniquerowid. My target points to the Feature class SEEDED field based on the sql expression. Any suggestions? var fc = FeatureSetByName($datastore,'SUDOE.DBO.s123_pandareclam',['SEEDED']); var t_parent = $feature.parentrowid; var sql = "uniquerowid = '" + t_parent + "'"; var target = First(Filter(fc, sql)); var t_seed = $feature.seeded_mulched if ((t_seed) == "Satisfactory") { target = "PASS"; } After enabling the trigger as an attribute rule. When I change seeded_mulched to "Satisfactory", it reverts back to null.
Instead of doing a static field calculate in order to symbolize my data by the related features I am trying to updated the parent as the related records are edited using attribute rules.
Any suggestions?
var sql <SPAN class="operator token">=</SPAN> <SPAN class="string token">"VALVE_ID = '"</SPAN> <SPAN class="operator token">+</SPAN> $feature<SPAN class="punctuation token">.</SPAN>valveid <SPAN class="operator token">+</SPAN> <SPAN class="string token">"'"</SPAN> var guid <SPAN class="operator token">=</SPAN> <SPAN class="string token">"'"</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="token function">TOP</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">filter</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">FeatureSetByName</SPAN><SPAN class="punctuation token">(</SPAN>$datastore<SPAN class="punctuation token">,</SPAN><SPAN class="string token">'UTILITIES.DBO.uti_wdSystemValve'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'globalid'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN>sql<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">"'"</SPAN><SPAN class="punctuation token">;</SPAN> var date_ <SPAN class="operator token">=</SPAN> $feature<SPAN class="punctuation token">.</SPAN>exercisedate <SPAN class="keyword token">return</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'edit'</SPAN><SPAN class="operator token">:</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'className'</SPAN><SPAN class="operator token">:</SPAN> <SPAN class="string token">'UTILITIES.DBO.uti_wdSystemValve'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'updates'</SPAN><SPAN class="operator token">:</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'GLOBALID'</SPAN><SPAN class="operator token">:</SPAN> guid<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'attributes'</SPAN><SPAN class="operator token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'lastexercised'</SPAN><SPAN class="operator token">:</SPAN> date_ <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> <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>
HiT L ,
When you do a TOP of 1 record, you still have a collection although it has only 1 records. Maybe do a first (this will return the record) and explicitly consult the globalid from that record.
Something like this on line 2:
<SPAN class="string token">"'"</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="token function">First</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">TOP</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">filter</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">FeatureSetByName</SPAN><SPAN class="punctuation token">(</SPAN>$datastore<SPAN class="punctuation token">,</SPAN><SPAN class="string token">'UTILITIES.DBO.uti_wdSystemValve'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'globalid'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN>sql<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'globalid'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">"'"</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
I also haven't seen this type of return value (object) that you are returning. Does that work?
I am trying to return just the globalid of the top record as set the globalID as the variable. It works when I hard code a globalid.
The below works, but it obviously does not use the variables.
var valves <SPAN class="operator token">=</SPAN> <SPAN class="token function">FeatureSetbyName</SPAN><SPAN class="punctuation token">(</SPAN>$datastore<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"UTILITIES.DBO.uti_wdSystemValve"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'globalid'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> var valve <SPAN class="operator token">=</SPAN> <SPAN class="token function">first</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">filter</SPAN><SPAN class="punctuation token">(</SPAN>valves<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"VALVE_ID = '"</SPAN> <SPAN class="operator token">+</SPAN> $feature<SPAN class="punctuation token">.</SPAN>valveid <SPAN class="operator token">+</SPAN> <SPAN class="string token">"'"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> var date_ <SPAN class="operator token">=</SPAN> $feature<SPAN class="punctuation token">.</SPAN>exercisedate <SPAN class="keyword token">return</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'edit'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'className'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'UTILITIES.DBO.uti_wdSystemValve'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'updates'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'globalID'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'{DE10ED35-B0A6-4E0B-86E7-0012405029F8}'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'attributes'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'lastexercised'</SPAN><SPAN class="punctuation token">:</SPAN> date_ <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> <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>
If you try the expression below, what does it return to the console?
<SPAN class="keyword token">var</SPAN> valves <SPAN class="operator token">=</SPAN> <SPAN class="token function">FeatureSetbyName</SPAN><SPAN class="punctuation token">(</SPAN>$datastore<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"UTILITIES.DBO.uti_wdSystemValve"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'globalid'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">var</SPAN> valve <SPAN class="operator token">=</SPAN> <SPAN class="token function">first</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">filter</SPAN><SPAN class="punctuation token">(</SPAN>valves<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"VALVE_ID = '"</SPAN> <SPAN class="operator token">+</SPAN> $feature<SPAN class="punctuation token">.</SPAN>valveid <SPAN class="operator token">+</SPAN> <SPAN class="string token">"'"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">var</SPAN> globaltext <SPAN class="operator token">=</SPAN> <SPAN class="string token">"'{"</SPAN> <SPAN class="operator token">+</SPAN> valve<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"globalID"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">"}'"</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="token function">Console</SPAN><SPAN class="punctuation token">(</SPAN>globaltext<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> date_ <SPAN class="operator token">=</SPAN> $feature<SPAN class="punctuation token">.</SPAN>exercisedate <SPAN class="keyword token">return</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'edit'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'className'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'UTILITIES.DBO.uti_wdSystemValve'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'updates'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'globalID'</SPAN><SPAN class="punctuation token">:</SPAN> globaltext<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'attributes'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="string token">'lastexercised'</SPAN><SPAN class="punctuation token">:</SPAN> date_ <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> <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>
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.