Select to view content in your preferred language

Near me Widget get queryParams.distance

365
6
4 weeks ago
vijaybadugu
Frequent Contributor

I would like to access input distance of Near me Widget, needs to display same in another widget using arcade.I tried this and nothing is showing 

Text($dataSources["widget_330_output_proximity_5868139358808708-output"].queryParams["distance"])/*
0 Kudos
6 Replies
VenkataKondepati
Frequent Contributor

Arcade isn't a "state manager" for the UI. It’s a data evaluator. If the Near Me widget doesn't explicitly write the "Search Distance" into a field in its output table, Arcade has nothing to read.

Check your Near Me widget settings—make sure "Return distance" is enabled in the results. Once it’s in the data, you can just pull it as a standard field like {Distance} instead of digging through queryParams.

Are you trying to show the maximum search radius allowed, or the actual distance to the closest found object?

Regards,
Venkat
Book a meeting with me:Get on a Call
Follow me on: LinkedIn
0 Kudos
vijaybadugu
Frequent Contributor

There is no option to return search distance, we have approximate distance return.

0 Kudos
VenkataKondepati
Frequent Contributor

Stop looking for the "Input" and start looking at the "Output." If the data is on the screen, it’s in the service. Find the field name in the Output Data Source and call that directly.

Are the results you're getting in the Near Me widget coming from a single layer, or are you searching across multiple feature classes?

Regards,
Venkat
Book a meeting with me:Get on a Call
Follow me on: LinkedIn
0 Kudos
vijaybadugu
Frequent Contributor

Yes. I am calling widget_330_output_proximity_5868139358808708-output of the Near me Widget, it is single layer

0 Kudos
VenkataKondepati
Frequent Contributor

// 1. Get the first feature from the Near Me output
var fs = $dataSources["widget_330_output_proximity_5868139358808708-output"]
var feature = First(fs)

// 2. Access the distance attribute created by the widget
// Note: This is a dynamic field, not a schema field
var dist = feature.distance

// 3. Return it with formatting
return Text(dist, "#.##") + " miles"

Regards,
Venkat
Book a meeting with me:Get on a Call
Follow me on: LinkedIn
0 Kudos
vijaybadugu
Frequent Contributor

vijaybadugu_0-1775503682333.png

In the Arcade suggestions box, I can see all available functions and properties. However, the issue is that I’m not able to retrieve the data from queryParams.
The previous snippet only displays the distance of the first feature, not the input search distance

0 Kudos