|
POST
|
Hola carpox_mpfn , Es importante saber que los identidades (usuarios nombrados) son personales y no pueden ser compartidos entre múltiples usuarios. Al hacerlo no solamente estás incumpliendo los el licenciamiento pero también te pierdes la trazabilidad de quién hice que cambio y no puedes controlar quién tiene acceso a que información.
... View more
06-05-2020
05:55 AM
|
0
|
0
|
3265
|
|
POST
|
Hi Joe Borgione and Dan Patterson , I see you are having fun with Arcade and Python. Can't wait to join the party Before getting in to what you can probably do with Arcade in the attribute rule, I have a question... If you want to assure that a value is within a list of possibilities, wouldn't that be solved by using a domain? I am sure that it can't be that simple, so I will continue with the Arcade fun part. What Joe was mentioning earlier of using the Distinct function in Arcade is correct. The example however, as you noticed, is using $layer, and $layer is not available in the attribute rule profiles. So, I am mentioning profiles and that is where a lot of the fun questions start with: depending the profile (where you want to execute the Arcade expression) you have a set of functions that you can use and a set of globals (the $ thingies) at your disposal. Attribute rules are executed at the database level. This is important since it defines what $ thingies are available. At a database level when an attribute rules is triggered, it has no knowledge of the map a layer might be participating in. So we don't have the $map and we algo wont have the $layer (since a layer only exists in a map). What we do have is the current $feature (and the $originalFeature which provides a lot of fun too) and the $datastore. What I normally do is I go to the Arcade playground (a place where you can play with Arcade and have fun or a huge headache): ArcGIS Arcade | ArcGIS for Developers . There you can select the profile of where you want to use Arcade: Not sure if you want to create a Calculation AR or a Constraint AR (raise error during edit) or Validation AR (for example for batch validation). The globals and functions will not be very different but the return value will be. When you select the profile you will see the globals available: The idea is to have access to the "layer" using the $datastore. The datastore is a FeatureSetCollection and you will have to indicate which FeatureSet you want to execute the rule on. For instance: FeatureSetByName($datastore, "Name of your FeatureSet in the datastore") In combination with the Distinct function is will be this: var fs = Distinct(FeatureSetByName($datastore, "Name of your FeatureSet in the datastore") , "FieldName"); Now you will have a featureset which you can use to check if a value is in the list of values. You will still have to do a loop to see if the value is any record of the FeatureSet since you cannot use things like IndexOf on this since "fs" is not an array but a FeatureSet. So, probably more eficiently would be doing something like this: var searchValue = 1023 // $feature.FieldName;
var sql = "NGHBRHDCD = @searchValue";
return (Count(Filter(FeatureSetByName($datastore,"Tax_Parcels"), sql)) > 0);
You read out the value you want to test and you set up a sql, which you use to filter the FeatureSet from the datastore and do a count on the result. If that is more than 0 the value exists (returns true) and if not it will return false.
... View more
06-04-2020
04:53 PM
|
4
|
4
|
14565
|
|
POST
|
Hi OakdaleGIS , Could you look at the actual content of the building number field where you see this behavior? I am using the IsEmpty function and when the field is not actually empty it will not work. If the field is string, please check that there are no spaces in this field, since it will not be detected as empty.
... View more
06-04-2020
11:59 AM
|
0
|
9
|
3118
|
|
POST
|
Hi kmsmikrud , I am glad that the expression is doing what you wanted to achieve. At this point I am not sure if the expression will work in Collector. Support for Arcade is incrementing with each release, but the best you can do is try it out and when you do, please post back your findings.
... View more
06-04-2020
11:55 AM
|
0
|
0
|
5200
|
|
POST
|
Hi OakdaleGIS , Could you try this? if (IsEmpty($feature["building_number"])) {
return "";
} else {
return "Resident" + TextFormatting.NewLine +
Concatenate([$feature["building_number"], $feature["street_name"], $feature["street_type"], $feature["street_direction"]], ' ') +
TextFormatting.NewLine + $feature.city + ", " + $feature.state;
}
... View more
06-03-2020
03:45 PM
|
0
|
13
|
3118
|
|
POST
|
Hi [email protected] , Unfortunately, in the symbology profile it is not possible to access values from another featureclass. You can only access the attributes of the current feature to define the symbology. In case this a a static condition, you could perhaps create a field and use the field calculation to perform the validation and use that field for symbology. Can you explain a little more about your use case? Why does a value in another featureclass define the visibility of a layer? Is this only in the current view window or does this apply to the entire featureclass?
... View more
06-03-2020
11:42 AM
|
0
|
0
|
1167
|
|
POST
|
Hi Kathy Smikrud , To get the sum of the values in the repeat you can use the following expression: // Get the related surveys from feature
var surveys = FeatureSetByRelationshipName($feature, "EscapementSurveys");
// get number of surveys
var cnt1 = Count(surveys);
var cnt2 = 0;
// initialize values (ignore SPECIES_CODE)
var mouth = 0; // MOUTH
var tidal = 0; // TIDAL
var live = 0; // LIVE
var dead = 0; // DEAD
// check if there are any suveys available
if (cnt1 > 0) {
// sort surveys on date
var surveyssorted = OrderBy(surveys, 'OBS_Date DES');
// take most recent survey
var survey = First(surveyssorted);
// get repeats for this survey
var repeats = FeatureSetByRelationshipName(survey, "repeat_SpeciesCounts");
cnt2 = Count(repeats);
if (cnt2 > 0) {
// we have repeats, now sum values
for (var repeat in repeats) {
mouth += repeat.MOUTH;
tidal += repeat.TIDAL;
live += repeat.LIVE;
dead += repeat.DEAD;
}
}
}
// create resulting text for pop-up
var result = "";
if (cnt2 > 0) {
// there are repeats, so construct the resulting text
result = "Mouth: " + mouth;
result += TextFormatting.NewLine + "Tidal: " + tidal;
result += TextFormatting.NewLine + "Live: " + live;
result += TextFormatting.NewLine + "Dead: " + dead;
} else {
// no repeats found, return a text to explain that
result = "No counts available";
}
// return the result
return result; See below the result in the pop-up: In case you want to show the counts per specie code, you can use the expression below: // Get the related surveys from feature
var surveys = FeatureSetByRelationshipName($feature, "EscapementSurveys");
// get number of surveys
var cnt1 = Count(surveys);
var cnt2 = 0;
// check if there are any suveys available
var result = "";
if (cnt1 > 0) {
// sort surveys on date
var surveyssorted = OrderBy(surveys, 'OBS_Date DES');
// take most recent survey
var survey = First(surveyssorted);
// get repeats for this survey
var repeats = FeatureSetByRelationshipName(survey, "repeat_SpeciesCounts");
cnt2 = Count(repeats);
if (cnt2 > 0) {
// we have repeats, now aggregate the repeat per species: SPECIES_CODE
var stats = GroupBy(repeats, ['SPECIES_CODE'], [
{name: 'sumMOUTH', expression: 'MOUTH', statistic: 'SUM'},
{name: 'sumTIDAL', expression: 'TIDAL', statistic: 'SUM'},
{name: 'sumLIVE', expression: 'LIVE', statistic: 'SUM'},
{name: 'sumDEAD', expression: 'DEAD', statistic: 'SUM'}]);
// read the aggregation and create the text
for (var stat in stats) {
result += TextFormatting.NewLine + TextFormatting.NewLine + "Specie code: " + stat["SPECIES_CODE"];
result += TextFormatting.NewLine + " - " + "Mouth: " + stat.sumMOUTH;
result += TextFormatting.NewLine + " - " + "Tidal: " + stat.sumTIDAL;
result += TextFormatting.NewLine + " - " + "Live: " + stat.sumLIVE;
result += TextFormatting.NewLine + " - " + "Dead: " + stat.sumDEAD;
}
} else {
result = "No counts available";
}
} else {
result = "No counts available";
}
// return the result
return result; The result will display as this: In your email you mentioned that you want to access the previous survey counts, so not the latest record. In that case you would still have to sort the surveys on date but now loop through the surveys and take the second. This is a bit longer than using the First function, but it can be done.
... View more
06-03-2020
10:36 AM
|
2
|
2
|
6058
|
|
POST
|
Hi atothgwe , I'm glad to hear that it works. If you have any question about the expression just post back here.
... View more
06-02-2020
09:38 AM
|
0
|
0
|
1988
|
|
POST
|
Hi Ariana Toth , Thanks for sharing the map and data. See below a screenshot of a situation where you have both engineering and planning services: I ended up using 2 expressions so you can format the text color for each list separately. You will also find a dictionary (line 8 to 11 for engineering and 8 to 14 for planning) with the actual text that will be displayed in the list. It will use the name of the field (before the ":") to retrieve the description (behind the ":"). Engineering Arcade expression (27): var Eclient = $feature.ENGINEERING;
var result = "";
if (Eclient == "Yes") {
// Engineering client
var flds_engi = ["PLANREVIEW", "WATER", "SANITARY", "STORM", "ROAD", "WATERTREATMENT", "GIS", "ASNEEDED"];
// remap dictionary for text to display in pop-up
var dct_engi = {"PLANREVIEW": "Plan Review", "WATER": "Water Systems",
"SANITARY": "Sanitary Systems", "STORM": "Stormwater Systems",
"ROAD": "Roads", "WATERTREATMENT": "Water Treatment",
"GIS": "GIS", "ASNEEDED": "As Needed"};
var Eserv = FeatureSetByRelationshipName($feature, "Engineering_2020", flds_engi, false);
var cnte = Count(Eserv);
if (cnte > 0) {
// there are related records, take first (or do you need all?)
var Efeat = First(Eserv);
for (var i in flds_engi) {
var fld = flds_engi[i];
var data = Efeat[fld];
if (data == "Y") {
if (result == "") {
result = dct_engi[fld];
} else {
result += TextFormatting.NewLine + dct_engi[fld];
}
}
}
} else {
// no related records
result += "None";
}
} else {
// Eclient == No
result += "None";
}
return result; Planning Arcade expression (28): var Pclient = $feature.PLANNING;
var result = "";
if (Pclient == "Yes") {
// Planning client
var flds_plan = ["CodeBook", "DevelopmentGuidebook", "PublicFacilitation", "MasterPlan", "RecPlan_Grants_Other", "DistrictStudies_Plans", "TIFPlan", "RetainerService", "HourlyServices", "Website", "ZoningAmendments", "StreetScapeDesign", "Wayfinding", "FormBasedCodes"];
// remap dictionary for text to display in pop-up
var dct_plan = {"CodeBook": "Code Book", "DevelopmentGuidebook": "Development Guidebook",
"PublicFacilitation": "Public Facilitation", "MasterPlan": "Master Plan",
"RecPlan_Grants_Other": "RecPlan Grants (Other)", "DistrictStudies_Plans": "District Studies Plans",
"TIFPlan": "TIF Plan", "RetainerService": "Retainer Service",
"HourlyServices": "Hourly Services", "Website": "Website",
"ZoningAmendments": "Zoning Amendments", "StreetScapeDesign": "Street Scape Design",
"Wayfinding": "Wayfinding", "FormBasedCodes": "Form Based Codes"};
var Pserv = FeatureSetByRelationshipName($feature, "Planning_2020", flds_plan, false);
var cntp = Count(Pserv);
if (cntp > 0) {
// there are related records, take first (or do you need all?)
var Pfeat = First(Pserv);
for (var i in flds_plan) {
var fld = flds_plan[i];
var data = Pfeat[fld];
if (data == "Y") {
if (result == "") {
result = dct_plan[fld];
} else {
result += TextFormatting.NewLine + dct_plan[fld];
}
}
}
} else {
// no related records
result += "None";
}
} else {
// Pclient == No
result += "None";
}
return result;
The pop-up was configured like this (I removed the other information for simplicity):
... View more
06-02-2020
08:17 AM
|
1
|
2
|
6121
|
|
POST
|
Hi Barrett Lewis , In your code, the reason that you get a single value, is because you are using "=" and not "+=" on line 7. That is why during the loop the value is not added to the result, but it replaces the previous value. I think in this case you should be able to use the GroupBy function on the related records to get a unique list of values Let me give you an example: var relatedrecords = FeatureSetByRelationshipName($feature,"PDX_Metro_Placement_Reporting_No_TicketHome", ["Reporting_Program_Recode"]);
var cnt = Count(relatedrecords);
var relatedinfo = "";
if (cnt > 0) {
// use GroupBy to summarize the field Reporting_Program_Recode
var stats = GroupBy(relatedrecords, "Reporting_Program_Recode",
[{name:"count", expression:"Reporting_Program_Recode", statistic:"COUNT"}]);
// report the result
relatedinfo = "Reporting Program Recode:"
for (var stat in stats) {
relatedinfo += TextFormatting.NewLine + " - " + stat.Reporting_Program_Recode + " (" + stat.count + ")";
}
} else {
relatedinfo = "No related information";
}
return relatedinfo;
... View more
06-02-2020
06:55 AM
|
1
|
0
|
1504
|
|
POST
|
Hi Andy Egleton , To be honest, I haven't seen any functionality to test is something exists depending on the version. Attribute rules are executed on a database level. For instance, ArcGIS Pro 2.5 has support for it when you use a FGDB. However, when you point to an enterprise geodatabase and it is part of Enterprise 10.7, I don't think $originalFeature will be available. It was introduced at version 1.9 (January 2020), see: Release Notes | ArcGIS for Developers. And when you look at the Version Matrix | ArcGIS for Developers you can see that Enterprise 10.7 has Arcade version 1.5 and Arcade 1.9 was introduced in Enterprise 10.8.
... View more
06-02-2020
06:41 AM
|
0
|
0
|
2187
|
|
POST
|
Hi Ariana Toth , Just to clarify, I work for Esri Colombia (not Esri USA), but I am happy to help. The easiest way to share the data without making it public, is to create a group and share the map and data with that group and invite my user "xbakker.spx" to that group. That way I will have access to your data and it wont be shared publicly. Any changes to the map that I will make will be saved locally (in my organization), but I will share them with you through this post. Once we solved the problem, you can stop sharing the data and map and I will loose access to the data. Another way of sharing the data is to export the data to a FGDB, download it and email it to xbakker [at] esri.co. But this would requiere me to publish the data again: the first option is easier.
... View more
06-02-2020
06:30 AM
|
0
|
3
|
1988
|
|
POST
|
Hi Ariana Toth , The two script do have a lot in common, but the second one, should take into that a client could have engineering and planning services. I do notice an error on line 39 where I use "Eserv" which should be "Pserv". In theory, by using a list of relevant fields per featureservice, you can loop through the list and extract the values a feature has in each field. I do wonder if this works when using the syntaxis like "Pserv[fld]" since normally you extract them like Pserv.fieldname. I could check this if I had access to actual data. Using variables "flds_plan" and "flds_engi" to specify the list of fields, is to be able to use that same list of fields on lines 14-15 and 43-44 to loop through the fields and extract the value of that field and if it is "Y" te return the name of the field as engineering or planning service. I also included a question in the code. How many related records do you normally have per feature? Is it 1:1 or 1:n. In caseo of 1:n what would you like to do with these multiple records? To help you further I will really need to have access to data so I can see what is going wrong with the code.
... View more
06-01-2020
05:03 PM
|
0
|
5
|
4133
|
|
POST
|
Hi Kathy Smikrud , I suppose that it should be possible feeding a row from the 1st related table when fetching the 2nd related table using the same FeatureSetByRelationshipName. If you can share the data I can look at it with more detail (AGOL user "[email protected]").
... View more
06-01-2020
03:20 PM
|
0
|
3
|
6065
|
|
POST
|
Hi Ariana Toth , Without access to data it will be very hard to detect where things go wrong. However, the fact that there is no result in the pop-up (no text at all) confirmes that there is something wrong with the syntax of the expression.
... View more
05-29-2020
10:48 AM
|
0
|
7
|
4133
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-09-2020 09:26 AM | |
| 6 | 12-20-2019 08:41 AM | |
| 1 | 01-21-2020 07:21 AM | |
| 2 | 01-30-2020 12:46 PM | |
| 1 | 05-30-2019 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
4 weeks ago
|