Hello everyone,
I am having the following problem.
I have a parent feature layer (globalID) and 4 child tables (parentGuid).
I wrote this simple arcade expression to access the related table attribute:
I found a workaround. Not very aesthetically beautiful, but at least I have something.
Since the table popup works fine, I configure it and then in the parent layer popup I add a 'Related Records' that contains the relationship to the problematic table.
But at this point I am more curious to know why the attribute expression doesn't work!
What do you think of my problem and my solution? Is there another 'nicer' one?
Thanks for any help!
carla
"Verify test data" indicates that the way you are attempting to access your FeatureSet arrays is not valid. You have three points where you access data by invoking a hardcoded string as the reference name:
It's important to check for misspellings or missing characters for each of these on the table, as a slight difference could cause the script to fail.
If you want to identify which of the three is having a problem, you can add console statements in between each to help break it down further. That would look something like this:
var relatedrecords = FeatureSetByRelationshipName($feature, "TabellaDifetti");
//if this statement doesn't print to console, the relationship name was invalid
Console("Relationship successful - 'TabellaDifetti' exists")
var orderedRecords = OrderBy(relatedrecords, "Data DESC")
);
//if this statement doesn't print to console, the column "Data" does not exist in the dataset.
Console("Ordered features - column 'Data' exists")
var cnt = Count(orderedRecords);
var output = "";
if (cnt > 0) {
var info = First(orderedRecords);
output = 'etichetta: '+ info.Numero_albero
//if this statement doesn't print to console, the column "Numero_albero" doesn't exist
Console("Output Defined: colmn 'Numero_albero' exists")
}
return output;
Thank you for your help!
I checked with Console statement and this one is the output:
Relationship successful - 'TabellaDifetti' exists
Ordered features - column 'Data' exists,
so it look like that Numero_albero doesn'exist, but It does. See attachment.
Shouldn't an error in the feature name produce a different error in the Output?
Without changing anything, expect the name of the table, I use the same code for other three table (that have the same Numero_albero field) with no error.
So, in this picture the "Numero_albero" field is an integer field, so the value being returned shouldn't be able to concatenate with a string as you have coded it. You would instead need to do:
output = 'etichetta: '+ Text(info.Numero_albero, "###,###")
Based on this, I would guess that the "Numero_albero" fields in the other tables are not number fields?
Try returning the `info` variable, and post a screenshot of the output. See what that data looks like.
In the attachment you'll find the screenshot of the output of 'TabellaDifetti' (which doesn't work) and also the output always obtained with the same code of the other table. It works.
I think, the problem is in info... the only difference is the length of the record stored in info... is there a limit? I cannot find this information
Can you try returning `orderedRecords` and `relatedrecords` and show the outputs of those?