Select to view content in your preferred language

Featuresetbyportal not working on Feature Layer (hosted)

111
5
3 weeks ago
Strata_ChrisG
Emerging Contributor

Hello,

I am currently trying to pull data from a hosted feature layer into another hosted feature layer using the FeatureSetByPortalItem function. I run the formula as:

var p = Portal("https://********.maps.arcgis.com");
var features = FeatureSetByPortalItem(p, "itemid",layerid);

However when I run it it gives me the error: 

Invalid expression.
Error on line 2.
Object not found "layer name"

 

I was able to get the item id from the layer page in my organizations AGOL page and grabbed the layer id from copying the features path (in the table of contents) in ArcGIS Pro and then opening it in notepad on my desktop.

Not too sure where it is I am going wrong here. 

 

Any help would be appreciated!

0 Kudos
5 Replies
jcarlson
MVP Esteemed Contributor

The layer ID item ID refers to the ItemID of the Feature Service in your Content, it's independent of Pro.

jcarlson_0-1733257409818.png

The Layer ID is whatever is after /FeatureServer/ in the service URL.

 

- Josh Carlson
Kendall County GIS
0 Kudos
Strata_ChrisG
Emerging Contributor

Hi @jcarlson 

I currently have the formula as: 

var p = Portal('https://myorganizationurl.arcgis.com');
var features = FeatureSetByPortalItem(p, '=layerid');

 

But get the following message: 

Invalid expression.
Error on line 2.
Portal item not found =layerid

 

In the ESRI arcade documentation it says that in the syntax that the layerid and itemid are two separate values. Maybe I am still missing something?

 

For reference, this data is a hosted feature layer (uploaded by itself as a layer) to my organizations AGOL account.

 

Thanks Again!

 

0 Kudos
jcarlson
MVP Esteemed Contributor

Whoops, sorry about that, I think I misread your initial post. I amended my response.

Your reply has a different error message in it. Are you logged into the Portal on Pro? Is it shared appropriately?

- Josh Carlson
Kendall County GIS
0 Kudos
Strata_ChrisG
Emerging Contributor

I am logged into my organizational portal on Pro. I am trying to use the field calculator on layers I added to the map from my organizations portal. 

Thanks Again!

0 Kudos
Strata_ChrisG
Emerging Contributor

Hi @jcarlson,

 

I was finally able to get it to work my using 'https://www.arcgis.com' instead of my organizational url. However, this only works for two of my layers that I am using.

The rest of my feature layers return:

Invalid expression.
Error on line 3.
Portal layer not found 0

 

When I use my organizational portal instead of 'https://www.arcgis.com') I get:

Invalid expression.
Error on line 3.
Portal item not found '64b7897d98fa89dfdfada'.

 

All my hosted feature layers where uploaded the same so I am not too sure what might have been the issue.

Thanks again for all your help so far! I honestly thought I had it once I ran it on one hosted feature layer until I got the errors on another layer.

0 Kudos