Select to view content in your preferred language

Changing data source of widget

611
6
04-23-2024 12:20 PM
Paco
by
Frequent Contributor

Hello all!   Does anyone know how to change the Data Source(new Feature Layer) of a widget without having to to reset all the parameters on that widget?

meaning,  we have 'Versions' of our Hosted Feature Layers,  and each time we update a version I need to choose the new Feature Layer within each widget,  and all the parameters go back to Default and I need to re-populate the parameters I need.

Is there a way to Save those widget parameters for each new updated Feature Layer?

thx!

6 Replies
chill_gis_dude
Regular Contributor

I don't think this is possible... it's kind of an nonstarter for us and is definitely a headache. Widgets should be able to be copy and pasted between experiences and should be able to have their data sources swapped out without breaking. Maybe in the future. 

Paco
by
Frequent Contributor

Agreed.  if the Schema of a new Feature Layer is the same as the previous data source Schema,  it should be a simple swap.  

We have one Experience(that works quite well) that takes ALOT of re-relating and re-setting of widget parameters.  thankfully the other few Experiences we have only takes minimal swapping and updating. BUT, these parameters should translate much more simply and easily. 

ESRI?  any help or news on this?

thx

0 Kudos
jgasser
Emerging Contributor

I came here to post nearly the same question.  I have two instances of a road centerline layer in a web app.  I want to change all the widgets to reference and interact with the second one, but changing the data source resets all the settings. 

 

I think this may be possible with AGO Assistant and/or ArcGIS Assistant, but I don't know enough about those.  I'm going to try to figure it out and I'll post an update here if I figure it out.

jgasser
Emerging Contributor

Well, I thought I had figured it out.  I used the ArcGIS Assistant tool to view the JSON files for my web map and experience app.  I saved copies of each, then tried finding and replacing within the web app's JSON file.  My old road centerline layer (with widgets configured to it) was referred to as the road centerline's ID, followed by "-layer-1", and the new layer that I wanted the widgets to connect to was the same ID (because it's the same data) followed by "layer-8".  I confirmed these in the web map's JSON file.  However, finding and replacing all instances of that did not solve the problem.  The list widget showed an error, "Data is inaccessible".

I decided to just fix things manually, which included re-configuring the list widget content, tools, etc.  I believe the "Actions" still appeared to be intact, but they did not actually work; selecting a feature on the list selected the centerline, but did not pan and zoom to like it was supposed to.  I had to delete the actions and recreate them for it to work again.

Like you said, it should be a simple, painless process to switch the data sources when the schema is the same, but I was not able to get it to work through the actual ESRI software, or with the ArcGIS Assistant.  I still think it's possible with the Assistant, and I may look into it more thoroughly some day. 

Good luck!

0 Kudos
Paco
by
Frequent Contributor

Thanks for taking a look within the Assistant,  I may do the same.   Im hoping this query can get pushed or seen by ESRI staff,  as it would certainly streamline and help keep ExB relevant for larger and versioned datasets.

cheers

0 Kudos
DavidTillberg_community
Occasional Contributor

I was able to do this using the ArcGIS online Assistant.  In the Web map JSON, I found & replaced all "url" properties with the ".../FeatureServer" references from old URL to new one, and also found & replaced all the "itemId" properties in the same locations from the old to the new one.  There is an itemId that corresponds to each FeatureServer in AGO.  I made sure when publishing that the service layer IDs (ie, .../FeatureServer/2) were the same for each dataset from old to new versions, and all fields the same.  In this same area you are making change, note there is an "id" property.  This is what the widgets actually use to id the data, then uses the itemId / url properties to find the underlying data.

Finally, I opened the Web Experience JSON in the ArcGIS online Assistant.  I was making a copy of the Web Map to the new data, and duplicating the Web Experience to point to the duplicated Web Map.  All I changed here was the "dataSources" key that is almost at the very end of the JSON.  Make sure it is pointing to new Web Map.  If you are not making a copy before changing the data source, this itemId is probably already correct.

I wasn't using a List widget, but had other widgets that worked correctly after the changes.

 

0 Kudos