Select to view content in your preferred language

How to Displaying all informations of each point in Pop-Up Window

505
0
07-06-2023 11:09 AM
Labels (2)
MahboobehTayebi
New Contributor

Hello, I have a set of points with unique identifiers (IDENT), and for each point, different treatments (TRMNT) were applied on different dates.

Here is the structure of my data:

MahboobehTayebi_0-1688666250321.png

 

I am trying to visualize all the information for each point, including the treatment and date, using the results of the FeatureSetByRelationshipName function. I found a solution on the Esri Community website in this post: "Displaying all information from a FeatureSetByRelationshipName."

I made some changes to the script as follows:

Spoiler

var relatedrecords = OrderBy(FeatureSetByRelationshipName($feature,"Invasive_Inspection_new"), "Date");
var cnt = Count(relatedrecords);

var relatedinfo = "";
if (cnt > 0) {
// use GroupBy to summarize the Date of all Treatment
var stats = GroupBy(relatedrecords, "Date", [
{ name: "count", expression: "Date", statistic: "COUNT" }
]);

var infos = GroupBy(relatedrecords, "TRMNT", [
{ name: "count", expression: "TRMNT", statistic: "COUNT" }
]);
// report the result
relatedinfo = "Treatment Date:"
for (var stat in stats) {
relatedinfo += "\n" + Text(ToLocal(stat.Date), "MM/Y")+ " (TRMNT: ";
for (var info in infos) {
relatedinfo += info.TRMNT +")" ;
}
}

} else {
relatedinfo = "No related information";
}

return relatedinfo;

Following the instructions provided in that post, I managed to display the dates successfully. However, I encountered an issue where the correct information for the treatments (TRMNT) is not displayed for each date. Instead, all treatments are being shown for each date. I attempted to solve this problem by implementing a loop to select the appropriate treatment information for each date, but unfortunately, it did not work.

The resulting pop-up display appears as follows:

MahboobehTayebi_1-1688666873328.png

Would you please help me?

0 Kudos
0 Replies