Whenever a big change is made to the Web Map, let's say the current dataset gets deleted, and a new one gets added. The experience builder components, let's say query widget, filter widget, won't just automatically switch to the new one.
When a situation like this occurs, the team I'm in would manually reconfigure these widgets, which can be time consuming. Are there better ways to tackle this problem?
Solved! Go to Solution.
It turned out to be pretty simple. On the left panel, there is Data at the third row. Click on that and you would see the data sources title. If you would go to your local folder, ArcGISExperienceBuilder > server > public > apps > {app_number}. There is a config.json, and if you go deeper down into the folder "resources > config", there is another config.json.
These two config files tell the app which widget belongs to what data source. If you search for the data source title (control+F), there should be one exact match (unless you accidentally imported the same data source multiple times). There is one section that says "itemId". By swapping this itemId with another data source's itemId, you would swap all the widgets.
If you're using Enterprise, you can use ArcGIS Assistant to point your web map to the new data. With the web map changed, you won't need to change anything on the Experience Builder side (UNLESS something about your data/schema changed and any aspect of the map or widget setup no longer works with the new data--in that case, you'll need to reconfigure the widget, and I wouldn't bother with using ArcGIS Assistant for that unless there's someone on your team very confident with JSON). Note that you should read the guide before doing anything, practice with some dummy data and maps, etc.
There's also an ArcGIS Online Assistant (I haven't used it, but I imagine it functions similarly).
The only workflow I've found that minimises this issue is to overwrite existing content in-place.
Unfortunately, this is not an option if you're using Scene Layers.
This also feels true for settings in custom widgets. You might set it up with an Enumeration to track all the settings so you know which useDataSource is which for later on, but if you change one in the middle, the simpler approaches result in having to re-configure all the data source settings for most of the rest if not all.
I've had success in trying to hard code a 'none' data source as a place holder to get around that, to an extent, but I'm not confident this is the best way to handle that. (If its setup in a way that you know which index is which and leave some none data source, its easier to replace it in the array without everything moving down the array)
Hi TimWestern! You mentioned you had succes in trying to hard code a 'none' data source. Would you mind elaborate more than this? For example, what do you mean by hard code a none data source? For filter and query widgets, isn't 'None' the default data source, why hard code it.
I can't find the sample of code I used to do that But I think it had something to do with creating dummy useDataSource types with None in several of the text fields. by doing that by default, or after one was removed from a specific location, I could then update that one location in the array on its own.
I wish I could find the example I found weeks ago to demonstrate the idea though.
Note, it has 1 draw back, you'll need to check the data source id's before using them for queries and such.
This is best solution in your maps detali web provide in very good experience me.
It turned out to be pretty simple. On the left panel, there is Data at the third row. Click on that and you would see the data sources title. If you would go to your local folder, ArcGISExperienceBuilder > server > public > apps > {app_number}. There is a config.json, and if you go deeper down into the folder "resources > config", there is another config.json.
These two config files tell the app which widget belongs to what data source. If you search for the data source title (control+F), there should be one exact match (unless you accidentally imported the same data source multiple times). There is one section that says "itemId". By swapping this itemId with another data source's itemId, you would swap all the widgets.