Select to view content in your preferred language

Search Widget URL Parameter Not Working with Zoom To Action

263
3
Jump to solution
08-06-2024 11:20 AM
Labels (1)
Paul_M
by
New Contributor

I'm trying to allow links to an Experience Builder app from outside sources to incorporate a URL parameter that automatically opens the app and zooms to text entered in the Search widget box. In my app, searching via the Search widget zooms to the first location match and updates the URL accordingly. However, when entered as a URL parameter to visit or update the app page, it fills out the search box and highlights the first match, but does not zoom to the location. Why doesn't it zoom to the location when used as a URL parameter? Does anyone know of a workaround?

0 Kudos
1 Solution

Accepted Solutions
Paul_M
by
New Contributor

After some more troubleshooting, it seems that the zoom action does not work when the search widget is in the header. I'm guessing this is a bug. After moving it out of the header and onto the map, it is working. 

View solution in original post

0 Kudos
3 Replies
Paul_M
by
New Contributor

After some more troubleshooting, it seems that the zoom action does not work when the search widget is in the header. I'm guessing this is a bug. After moving it out of the header and onto the map, it is working. 

0 Kudos
FredericPoliart_EsriAU
Frequent Contributor

I am having issues crafting a URL to invoke/assemble a where query to a Search Widget in Experience Builder.

1. Extract the ExB data using https://ago-assistant.esri.com/ 
2. open in Notepad
3. Observe the JSON :  teh search widget is widget_30
 "widget_30": { "uri": "widgets/common/search/",
4. within the search widget JSON . I can see the various data sources of that search widget (that is the multiple datasources being used and configured ), 
It shows:

 "useDataSources": [
                {
                    "dataSourceId": "f50d125139c545daa1d1120cbe3ff54d-191076be876-layer-120-191076bf00d-layer-131",
                    "mainDataSourceId": "f50d125139c545daa1d1120cbe3ff54d-191076be876-layer-120-191076bf00d-layer-131",
                    "rootDataSourceId": "f50d125139c545daa1d1120cbe3ff54d",
                    "fields": [
                        "Property_Address",
                        "Property_Number",
                        "Assessment_Number"
                    ]
                },

 

For that queried layer -131<?> , there is an attribute called "Property_Number" and I know there is a PropID 16600080

So my URL looks something like this: 
https://experience.arcgis.com/experience/{PortalItemID}/#data_s=where:widget_30-dataSource_1-191076bf00d-layer-131:Property_Number=16600080


This doesn't seem to work. 

Q# Has anyone got a logical method to assemble a URL that would open Experience Builder and automatically inject a search in the search widget

Q# Is there a simpler way to do this?  like the good old /?find= in WebApp Builder. 


Ref:
https://doc.arcgis.com/en/experience-builder/latest/build-apps/url-parameters.htm#:~:text=Experience...

https://community.esri.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=false&f... 


ShengdiZhang
Esri Regular Contributor

Hi @FredericPoliart_EsriAU ,

If you have already configured the required data source and search fields in the search widget, you can simply use the URL parameter of the search widget without specifying the data source id.

You need to turn on the search widget URL status in the general settings. In your specific case, the URL will be as follows:

https://experience.arcgis.com/experience/<AppId>#widget_30=search_status:%7B"searchText"%3A"16600080"%7D

 

Besides, the JSON you provided for the search widget doesn't mean it uses multiple data sources, only the dataSourceId is used for searching. If you do configure multiple search sources for the search widget, but only want to filter one layer on load, you can add the sourceID to the URL parameter:

https://experience.arcgis.com/experience/<AppId>#<searchWidgetID>=search_status:%7B"searchText"%3A"<text>"%2C"status"%3A%7B"configId"%3A"<SourceID>"%7D%7D

 

Please refer details at: https://doc.arcgis.com/en/experience-builder/latest/build-apps/url-parameters.htm#ESRI_SECTION2_4481... 

 

If you want to filter the data source on load without using the search widget, you can use the data filter parameter, below is an example URL:

http://experience.arcgis.com/experience/<AppID>/?data_filter=191076bf00d-layer-131:Property_Number%3D16600080

 

Regards,

Shengdi