In the Coronavirus Response solution, if I add custom fields to the Cases feature layer, do I have to recreate the three feature layer views from scratch? It does not seem you can update the views with new fields on the source feature layer.
Solved! Go to Solution.
Summarizing in one comment. Hopefully that's useful!
When adding a new field to the Cases feature layer the new field will need to be accounted for on the views created from the Cases feature layer. Getting the new field on the view depends on the type view:
Cases_public is just a basic view of Cases with editing turned off in Settings (used in the Community Impact Dashboard)
Cases_reporter - as above but with editing turned on (used by the Case Reporter survey)
Cases_current - a join view returning the most recent report for a reporting area.
A new field can be exposed on the existing Cases_public and Cases_reporter views, whereas Cases_current needs to be recreated. Let's look at exposing first:
In all likelihood a new field will be added to the Cases table which means the method of defining the fields exposed to the view using Visualization tab on the item page will not work. However, we can add the table to a map to set the view definition:
To get that new field on Cases_current it will need to be recreated:
Name: Cases_current or something similar. | Target: Reporting Areas | Layer to join to the target layer: Cases | Fields to match: name = name | Join Operation: Join one to one | Define which record is kept: Order by Date Reported / Sort by Newest |
Mike
I'm dealing with this today as well. From what little I know about hosted layer views, you cannot alter the schema of the view to include new fields from the source layers, so you have to recreate them all. To make it more complex, the 'Cases Current' hosted view does some aggregation from the cases table to the related boundaries layer, so that you have one table with the most recent counts for each boundary. The view was created by Esri's solution so I don't know you can see the code for how the join is done, let alone recreate it.
Hoping to get some answers this afternoon. I'll share here if I find out some tricks
-Andrew
I just heard back from Esri:
To [re]create the [Cases Current] view add the Cases feature service to the map viewer. From Analysis open the Join Features tool. Configure your settings for the join and at the bottom check the option to save the output as a hosted view.
To define the join you will do a 1:1 attribute join based on the name field, and sort on the Report Date field in descending order.
You still have to manually recreate all the views, but I hope that helps.
-Andrew
Thanks Andrew! I'm going to try to summarize. The Cases hosted feature layer has three views defined on it:
Cases_public is just a basic view of Cases with editing turned off in Settings. You can recreate it with the Create View Layer button and don't need to change the View Definition.
Cases_reporter - as above but with editing turned on.
Cases_current - as you describe above, recreate in Map Viewer with a join. It seems that target layer is "Cases", layer to join is "Cases - Cases", match fields where name = name, join one to one, order by Date Reported is Newest, save as a feature layer view.
You have to edit the Case Reporter form in Survey123 Connect. Add your new field names on the first sheet (don't forget the esriFieldType), and change the id in the submission_url in the Settings sheet.
Then you need to replace the Active Cases layer in the Community Impact Dashboard map with your new Cases_current view (might want to update the URL of the service using ArcGIS Online Assistant).
Then you might want to reconfigure the "Community Impact Dashboard" dashboard.
I think I have that right.
Nice explanation, Kevin Mayall! I think you have it right, too.
I'll just add you can also expose your new field to the existing Cases_public and Cases_reporter views by updating their view definition.
I tried to do that but they did not seem to have the Set View Definition option under the Visualization tab on the item page.
You can add the view to a web map and access Set View Definition that way as well.
This worked with perfectly with both cases_public and cases_reporter views. Why won't cases_current allow that?
Cases_current is a hosted join view and unfortunately there is no way to expose a new field added to one of the join view's sources. So that view would need to be recreated to pick up a new field. Andrew outlined that process well above:
To [re]create the [Cases Current] view add the Cases feature service to the map viewer. From Analysis open the Join Features tool. Configure your settings for the join and at the bottom check the option to save the output as a hosted view.
To define the join you will do a 1:1 attribute join based on the name field, and sort on the Report Date field in descending order.