|
BLOG
|
Now I don't have to hard code my portal when I build 3.10 in AppStudio...
... View more
09-03-2020
06:57 AM
|
0
|
0
|
10368
|
|
POST
|
I have a arcade expression that loops through a set of records and produces a comma separated list of parentrowids. for (var p in parentrowids) {
array += p.parentrowid + ", " ;
}
}
var prid_array = array;
} I have a where clause a few lines down that uses the IN operator to filter on another table. I get this error not matter how I try and produce the "array". When I write the value to a table using this string: var prid_array = "('"+ array + "')"; I get this: However the table is populated as ('{67D92A25-79C7-4225-9AD1-C140662DEFCF}', '{F269CECB-70D3-4288-8D11-102025D3D701}', '{99AB8E1B-2759-43CA-88DE-7A5A2FDECDC6}', '') Is there a way to output a string to be used in a IN operator? Xander Bakker
... View more
08-12-2020
12:08 PM
|
0
|
2
|
2484
|
|
POST
|
When I hard code in an array... var array = ["2", "2"] ... right into the expression, it works. However, when I add that same array into a field, then call that field instead within the function, it doesn't see it as an array. $feature.array = ["2", "2"] var array = $feature.array
Is there a way to call a string from a field and have the expression read it as a array? Xander Bakker
... View more
08-10-2020
01:50 PM
|
0
|
2
|
3446
|
|
POST
|
Speechless. I added the name of the field as mentioned above and it worked. I will compare yours and mine to get a better understanding. You rock! var pipe = first(pipes); // why only the first??? This is to make sure I only have one record. If that makes sense.
... View more
08-06-2020
12:24 PM
|
1
|
1
|
9902
|
|
POST
|
I did get that to work, but I had hard coded in my array. Now I am trying to create my array on insert. Lines 8 - 11 grab the related records and put them in an array. This breaks on line 17 when I comment out the hard coded array (line 12, but works when using var array. It would appear as though my array is not getting created. Any Ideas? var pipe = "";
var invoice = "";
var i = "";
var c = "";
var u = [];
var counter = 0;
var contract_fc = FeatureSetByName($datastore,"SUDOECMS.DBO.doe_EAP_pipelineabandon_contracts", ["contract"], false);
var sql = ("parentrowid = '" + $feature.uniquerowid + "'")
var array = filter(contract_fc, sql)
var cnt = count(array)
//var array = ["AM-094", "AM-095"]
if (cnt > 0) {
for(var c in array)
{
var pipe = FeatureSetByName($datastore,"SUDOECMS.DBO.doe_EAP_pipelineabandon", ["*"], false);
var invoice = filter(pipe, "invoice = '" + array[c] + "'");
var i = first(invoice);
u[counter] = {'globalID': i.GlobalID,
'attributes': {
'q_1': $feature.status,
'q_1comments' : $feature.q_xcomments,
'q_1rank' : $feature.q_xrank
}
}
counter++
}
return {
"result": $feature.q_x,
'edit': [{
'className': 'SUDOECMS.DBO.doe_EAP_pipelineabandon',
'updates': u
}]
}
}
else {
return $feature.q_x
}
... View more
08-06-2020
08:41 AM
|
0
|
3
|
9902
|
|
POST
|
I am having trouble with for loops. This example prints out the second item in the array. var array = ["RC-22p", "RC-22e"];;
for(var c in array) {
var invoice = array[c]
}
return invoice The result is RC-22e. I am trying to loop through an array, look up the corresponding globalid and update that related record. When I run my code the first item in the array is completed, but it stops after the first one, it doesn't loop... How can I get my for loop to loop when my return is updating another feature class? var array = ["RC-22H", "RC-22I"];
var pipe = "";
var invoice = "";
var i = "";
var c = "";
//loop
for(var c in array)
{
//lookup globalid based on item in array
var pipe = FeatureSetByName($datastore,"SUDOECMS.DBO.doe_EAP_pipelineabandon");
var invoice = filter(pipe, "invoice = '" + array[c] + "'");
var i = first(invoice);
//if feature value is q_1, update the other record
if ($feature.q_x == 'q_1'){
return {
"result": $feature.q_x,
'edit': [{
'className': 'SUDOECMS.DBO.doe_EAP_pipelineabandon',
'updates': [{
'globalID': i.GlobalID,
'attributes': {
'q_1': $feature.status,
'q_1comments' : $feature.q_xcomments,
'q_1rank' : $feature.q_xrank
}
}]
}]
}
}
//stops here but I want to repeat, it only updates the other record based on RC-22H, it does not update RC-22I. Xander Bakker
... View more
08-05-2020
01:47 PM
|
0
|
6
|
10033
|
|
POST
|
I have a simple attribute rule that works in Pro but fails in the web map/app. All of my other rules work that do not have geometry functions in both. Is there something I am missing? In the web app and Survey123 I get a "missing geometry" error which tells me its not seeing the 'fc' layer. var fc = FeatureSetByName($datastore,'SUDOECMS.DBO.LEGAL', ['*'], true);
var qtr = FIRST(within($feature, fc))
if ( !IsEmpty(qtr)) {
return qtr.FullDesc
}
else {
return $feature.legaldesc
}
... View more
06-30-2020
08:36 AM
|
0
|
0
|
716
|
|
POST
|
I figure they must be some soft of trigger or sp but I cant find them. Thanks.
... View more
06-12-2020
11:09 AM
|
1
|
2
|
3664
|
|
POST
|
I am actually trying to edit a different feature class using "Edit", which still does not work. What you are doing does work: { return Null; }
... View more
05-07-2020
11:12 AM
|
1
|
1
|
3375
|
|
POST
|
Have you tested with S123? I have not had luck with a trigger producing incremental values with S123. I currently have to use a Trigger & Job for my incremental values. SQL Trigger on table causes CODE 500 Error. SQL Trigger on featurclass in SQL SERVER
... View more
05-01-2020
09:58 AM
|
0
|
1
|
5058
|
|
POST
|
This is great, but it doesn't seem to work correctly when creating records in a Web App or Survey123. It increments by 2. Posting from the server seems to make two inserts causing the double incremental value. Anyone figure this out?
... View more
05-01-2020
08:18 AM
|
0
|
3
|
5058
|
|
POST
|
This script adds sequential values based on the last value. My problem is I have to have at least one value already in place for First() to work, else it errors out. Also when I try to add a Count() I get Array type expected error. How do you properly code for: AKA how do you check for empty table and if empty give it a value? if count == 0 {return something}
else do this
else do that
This code below works great as long as there one record in the table with an assignednum. If not it errors on line 3. I tried to code with IIf & IsNaN/IsEmpty with no avail. (Attribute Calculation Rule on Insert) Thanks. Xander Bakker var sql = Concatenate("assignednum like", "'%", Year(Now()), "%'")
var fs = first(OrderBy(Filter(FeatureSetbyName($datastore, table), sql), 'assignednum DESC'))
var lastnum = Number(mid(fs.assignednum,11,4),'0000' )
var int = ++lastnum
if (number(mid(fs.assignednum,6,4)) == Year(Now())) {
return Concatenate("SUDOE ",Year(Now()),"-",text(int,'0000'),"RCI")
}
else if (number(mid(fs.assignednum,6,4)) != Year(Now())) {
return Concatenate("SUDOE ",Year(Now()),"-0001","RCI")
}
... View more
04-28-2020
02:29 PM
|
0
|
1
|
1371
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-07-2026 08:20 AM | |
| 2 | 06-11-2026 02:54 PM | |
| 3 | 06-11-2026 05:45 AM | |
| 1 | 06-09-2026 02:07 PM | |
| 1 | 06-05-2026 01:26 PM |