Source: site.view [edit]
Function name: yahooLocalByDistance
Arguments: search,location
Description: Looks up records that match search at location 'place', using Yahoo Local
Page type: webl
Render function:   tableRender
Module: global

Page source:

var P = GetURL("http://api.local.yahoo.com/LocalSearchService/V3/localSearch",
   [. appid="wubhuboaa", sort="distance", query=search, location=location, result=20 .]);

var res = [];

var TextVal = fun(P, fieldname, elt)
   var E = Elem(P, fieldname) inside elt; 
   return (Str_Trim(Text(E[0])) ? "")
end;

var ListVal = fun(P, fieldname, elt)
   var E = Elem(P, fieldname) inside elt; 
   res = "";
   every child in Children(E[0]) do
      if (res != "") then
         res = res + ","
      end;
      res = res + Str_Trim(Text(child));
   end;
   return res
end;

every r in Elem(P, "Result") do
   res = res + [ [.
      title=TextVal(P, "Title", r),
      address=TextVal(P, "Address", r),
      city=TextVal(P, "City", r),
      state=TextVal(P, "State", r),
      phone=TextVal(P, "Phone", r),
      category=TextVal(P, "Category", r),
      categories=ListVal(P, "Categories", r),
      latitude=TextVal(P, "Latitude", r),
      longitude=TextVal(P, "Longitude", r),
      rating=TextVal(P, "Rating", r),
      averagerating=TextVal(P, "AverageRating", r),
      totalratings=TextVal(P, "TotalRatings", r),
      totalreviews=TextVal(P, "TotalReviews", r),
      distance=TextVal(P, "Distance", r),
      url=TextVal(P, "Url", r),
      mapurl=TextVal(P, "MapUrl", r),
      businessurl=TextVal(P, "BusinessUrl", r),
      desc=TextVal(P, "Address", r)+"<br>"+TextVal(P, "Phone", r)+"&nbsp;&nbsp;"+
         `<a target="_blank" href='` + TextVal(P, "Url", r)+`'>Details</a>`
    .] ];
end;

[. title="Results for " + search + " near " + location,
   items=res,
   zoomLevel = "5",
   width = 700,
   height = 500, 
   showIndex = "true"
.];