Model Builder not picking up created field in Field Caluclator - automate process help please

1017
8
02-25-2020 02:47 PM
NaomiBegg2
Occasional Contributor III

I'm trying to automate the process of an intersect which passes values from many Points within a layer, to the polygon that it intersects.  However I'm getting stuck when it comes to passing the values using the field calculator.

Here is what I have done so far.

1. Created an ActivityDate on my point layer (previously I was using the CreatedDate as the date field, however this wasn't coming across in fields)

2. Spatial join 1:many Polygon:Point

3. Joined this spatial join layer to the original Polygon layer (so that I can field calculate layers from the spatial join to the original layer).

4. Calculate field: LastMown (polygon) = ActivityDate (originally point but joined) 

       ERROR: Invalid Expression Datasource could not be found.

Some of the fields from the join are coming through (Action, Notes), however that field (or the createdDate field) aren't coming through.

There may be an easier way to do what I'm after - I'm all ears for a different way of doing this.

Ultimately I want to populate a 'last mown' field on my polygon layer with the date from the intersecting point layer which has a) the action 'completed' and b) the latest date.

After the above steps I was planning on doing a filter, to filter based on the Action == 'completed'.  Then dissolve the reserves (based on target_ID) with the latest date on it.

0 Kudos
8 Replies
NaomiBegg2
Occasional Contributor III

Xander Bakker‌ I'm thinking this is something that you probably know a much easier way of completing.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Naomi Begg ,

I suppose you could use a single calculation with a nice Arcade expression to do this entire process, but this is where the GP tools and modelbuilder are good at. 

0 Kudos
NaomiBegg2
Occasional Contributor III

Hi Xander Bakker‌ I do have this successfully working as an Arcade pop-up, however because it is an intersect I can't use the expressions for symbology and it didn't look like I could easily create a report based on this either.   

I'd like to make a filtered layer showing just the overdue areas, and a list of areas due this week.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Naomi Begg ,

If you have a working Arcade expression you can create a new field and execute the expression there to fill the field and being able to filter on that new field and use it for symbology. In Pro 2.5 you can schedule the field calculation in case the data is dynamic.

0 Kudos
NaomiBegg2
Occasional Contributor III

The arcade expression isn't working in Pro field calculator Datasource could not be found.  

I think this is because the intersect mentions $map, since it is two different layers not in the same datasource.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi njbegg ,

This is true, $map cannot be used in the Field Calculator and if they are not in the same $datasource that might be a challenge. If they are published to portal you could use "FeatureSetByPortalItem" though...

0 Kudos
NaomiBegg2
Occasional Contributor III

I've tried the FeatureSetByPortalItem and it works in the AGOL popup (layer is hosted in AGOL rather than Portal).  However when I try it in Pro Calculator I am still getting: Datasource could not be found.

I am logged into Pro using the same account, but does the calculator require login details within its query?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Naomi Begg ,

I would expect that using the portal item it would be possible in Pro when you are logged in to that portal. Is that layer added to Pro session? Is it possible to include both  layers in the same datasource. Another option is to revise the python script you can generate from the model. Since the latest version there have been a lot of enhancements to the quality and structure of a script generated from the export of a model.

0 Kudos