Select to view content in your preferred language

Configure custom analysis type for Near Me widget

456
2
11-29-2023 07:12 AM
ruikaitang_brampton
New Contributor II

I'm working with the dev edition of Experience Builder, and was wondering if anybody could point me in the right direction regarding where to start if I wanted to configure a custom analysis type for the Near Me widget beyond what is included in the stock version. I'm trying to port functionality over from a WebEx app but widgets seems to be a lot more complicated in ExB as they are no longer just a single file and appear to have a bunch of components now.

There are two types of analysis I need:

1) Specify the number of closest features rather than only showing the nearest feature (i.e. nearest 5 results to be shown, rather than just the nearest)

2) Show all results associated with the closest address point (e.g. show all the building permits for the address closest to the dropped pin).

I've made a copy of the source code for the near-me widget under client/your-extensions, but I seem to break the widget any time I try to modify any lines of code as the widget UI tends to just disappear and becomes replaced by an error message from the JS console. Troubleshooting has been kind of hard as there doesn't seem to be much documentation for the actual source code and how the different .tsx files interact, and the comments inside the code don't really help me understand how the widgets is structured overall.

If someone could point me in the right direction in regards to even just which .tsx files I should be looking to modify, and possibly which functions, that would be greatly appreciated.

0 Kudos
2 Replies
JeffreyThompson2
MVP Regular Contributor

I have not tried to modify Near Me, but generally speaking I have found it easier to create custom widgets from scratch than trying to modify ESRI code. Most of the complexity of the ESRI code is not because the goal is complicated. It's to support the optionality provided by the build mode. If you are building a widget designed to be used in a single application and you don't need it to interact with other widgets, you can basically ignore the build mode and do it all in code, making your task much simpler.

GIS Developer
City of Arlington, Texas
0 Kudos
ruikaitang_brampton
New Contributor II

What do you mean by "support the optionality provided by build mode"? I do want the widget to interact with a few others, like the search widget and print widget. In addition, the Near Me widget provides almost all the exact functionality I want in terms of how the results are displayed, I just want to modify the number of results and choose to limit results that are directly referenced to the closest address.

I did try to creating it from scratch but there will also be less technically inclined users on the team who may want to use the widget with different data layers in different apps (so I can't hardcode the layers into the code as I want them to be changeable in the ExB UI), and I don't think asking them to learn to code makes a lot of sense.

0 Kudos