Select to view content in your preferred language

Updating config.json results in text widget reformatting

832
4
06-24-2024 02:21 PM
BenjaminJimenez
Emerging Contributor

Hello,

I'm trying to update dataSource connections by using ArcGIS Assistant and updating the config.json and JSON for my Experience Builder application. However, when I do, the formatting text widgets in my application are removed (text size, color, justification). Additionally, any dynamic text I had is reformatted to static text (ex: SUM({insert field}). Has anyone encountered this issue before? Are there any solutions to this? 

4 Replies
kaifeiji
Occasional Contributor

A typical formatted text config looks like this:

<strong style=\"color: var(--danger); font-size: 15px; font-family: Calibri;\">some text</strong>
 
A typical dynamic text config looks like this:
<exp data-uniqueid=\"6b089f9a_65d1_87a2_f038_fcfe0409b71d\" data-dsid=\"dataSource_1-18e65439065-layer-2-18e6543a7b0-layer-3\" data-expression=\"%7B%22name%22%3A%22AVERAGE(%7BOBJECTID%7D)%22%2C%22parts%22%3A%5B%7B%22type%22%3A%22FUNCTION%22%2C%22exp%22%3A%22AVERAGE%22%7D%2C%7B%22type%22%3A%22OPERATOR%22%2C%22exp%22%3A%22(%22%7D%2C%7B%22type%22%3A%22FIELD%22%2C%22exp%22%3A%22%7BOBJECTID%7D%22%2C%22dataSourceId%22%3A%22dataSource_1-18e65439065-layer-2-18e6543a7b0-layer-3%22%2C%22jimuFieldName%22%3A%22OBJECTID%22%7D%2C%7B%22type%22%3A%22OPERATOR%22%2C%22exp%22%3A%22)%22%7D%5D%7D\"><span contenteditable=\"false\">AVERAGE({OBJECTID})</span></exp>
 
I'm not familiar with ArcGIS Assistant, but I guess updating the config.json with it results in removing all <> tags.
0 Kudos
MarkGoetz1
Emerging Contributor

Have you found a solution to this yet?

0 Kudos
Luci_Coleman
Esri Contributor

I have definitely see this before. 😥 I belive this is a known limitation of the ArcGIS Assistant when specifically editing the config.json (draft version) of an Experience Builder content item accessible through the Resources tab. If you make edits directly to the config.json within the code editor in ArcGIS Assistant, it wipes formatting of all text components. 

As a workaround, instead of making changes directly to the config.json within ArcGIS Assistant, you can download the file, then edit in a code editor. You can then upload the updated file back into the Resources within ArcGIS Assistant. This should preserve text formatting in draft. 

If your draft version is wonky and you want to restore the published version into the draft version of the app, try saving the published JSON as a file and then uploading it through the Resources tab within the ArcGIS Assistant to replace the existing draft config.json. That has worked for me in the past. 💪

0 Kudos
AaronKoelker
Frequent Contributor

I'm seeing this issue as well, but while using a script and the ArcGIS API for Python to update data sources in an ExB app, rather than manually through the ArcGIS Assistant. The script swaps the config.json file entirely via resources.remove() and resources.add(). 

-Aaron