Hi,
Having issues with retrieving a field from a FeatureSet. Following other examples, referring the Field name as per below is supposed to work:
myFeature.job_wo
myFeature["job_wo"]
However I get a:
Execution Error:Runtime Error: Cannot call member property on object of this type. job_wo
The below is my code for reference:
var portal = Portal('https://linktomyportal/');
var completed_surveys = FeatureSetByPortalItem(
portal,
'portalobjectid',
0,
[
'objectid',
'job_wo'
],
false
);
Console(completed_surveys.job_wo);
Solved! Go to Solution.
completed_surveys is a Featureset, a collection of features. You can only call the field name on single features.
So you have to extract a feature from the featureset. One way to do it:
var completed_surveys = ...
// just get the first feature
var survey = First(completed_surveys)
// we have to check that survey is not null, else we would produce an error
// by calling a member property of null
if(survey == null) {
Console("survey is null -> completed_surveys is empty")
} else {
Console(survey.job_wo)
}
completed_surveys is a Featureset, a collection of features. You can only call the field name on single features.
So you have to extract a feature from the featureset. One way to do it:
var completed_surveys = ...
// just get the first feature
var survey = First(completed_surveys)
// we have to check that survey is not null, else we would produce an error
// by calling a member property of null
if(survey == null) {
Console("survey is null -> completed_surveys is empty")
} else {
Console(survey.job_wo)
}