Select to view content in your preferred language

Verify test data

438
12
3 weeks ago
CarlaNardinocchi
Emerging Contributor

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:

var relatedrecords = OrderBy(
    FeatureSetByRelationshipName($feature, "TabellaDifetti"),
    "Data DESC"
);

var cnt = Count(relatedrecords);
var output = "";

if (cnt > 0) {
    var info = First(relatedrecords);
    output = 'etichetta: '+ info.Numero_albero
}
return output;
 
 
It works fine for 3 tables but not for the last one. I get the following Result: Test execution error: Unknown Error. Verify test data.
 
I am sure that the problem is in the table and not in the code, but I cannot imagine what it could be.
I have checked:
- the relationship is the same for all the 4 tables (simple, 1:M, forward) built in ArcGIS Pro and shared in AGOL
- I can see access to the related table from the parent feature
- the table should not be corrupted: I accessed to the record directly from the popup of the layer table and I can read it (using $feature.Numero_albero)
- I try to output the Text(info) and I get the same error...
 
This table has 1250 records and 1250 record, the type is integer or string and one date. The only difference from the other one is that the strings are 8000 character long, but ...the problem is also present with the numeric type.
 
Do you have any suggestion that I can check?
 
Thanks, carla
0 Kudos
12 Replies
CarlaNardinocchi
Emerging Contributor

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

0 Kudos
AustinAverill
Frequent Contributor

"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: 

  1. Relationship Name : `FeatureSetByRelationshipName($feature"TabellaDifetti")`
    1. It's possible that the relationship name for the failing table does not match this.
  2. Sort Colum : `"Data DESC"`
    1. It's possible that this column "Data" does not exist in your queried table
  3. Defining your output variable : output = `'etichetta: '+ info.Numero_albero`
    1. It is possible that this column "Numero_albero" does not exist in your queried table.

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;

 

CarlaNardinocchi
Emerging Contributor

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.

0 Kudos
AustinAverill
Frequent Contributor

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?

CarlaNardinocchi
Emerging Contributor

No, they are number field, too.

I attached the result where I changed the related Table!

As you see, this time Numero_albero is present!!!

0 Kudos
AustinAverill
Frequent Contributor

Try returning the `info` variable, and post a screenshot of the output. See what that data looks like.

CarlaNardinocchi
Emerging Contributor

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

0 Kudos
AustinAverill
Frequent Contributor

Can you try returning `orderedRecords` and `relatedrecords` and show the outputs of those?

CarlaNardinocchi
Emerging Contributor

I am not sure if this is the correct way to return orderedRecords and relatedRecords. They have the same output: text: "object, FeatureSet"

I have attached the screenshot of both

0 Kudos