0

Is it possible to point the search widget to related records? For example, I have a featurelayer of spaces, which is related to a table of names based on the spaceID. I would like to be able to search for spaces based on names of people related to those spaces. Something like below:

I'm using ArcGIS Javascript API 4.9.

var searchWidget = new Search({
    view: view,
    includeDefaultSources: false,
    allPlaceholder: "First or Last Name",
    sources:[{
        featureLayer: myFeatureLayer,
        searchFields: ["relationships/0/LASTNAME", "relationships/0/FIRSTNAME"],
        exactMatch: false,
        placeholder: "example: John Doe"
    }]
});

This doesn't work, but I was wondering if there is a similar approach to accomplish this task. The documentation does not specify.

2

The ArcGIS JavaScript API version 4.9 Search widget sources does not take the any feature layer associated with related table. Below is the sample which refuses to find addressee in the feature layer itself. Since it fails on feature layer there is no point of going ahead and configuring it with related record.

Sample: https://jsbin.com/hepigafulu Note: GEARY BLVD and MASONIC AVE is a valid address that you can try searching and it fails.
Note: Make sure you select the layer in the search widget.

The reason why I confirm the it fails with related tables is because it works completely fine with normal feature layers.

Sample: https://jsbin.com/difagijile Note: Try seraching new in search widget. Note: Make sure you select the layer in the search widget.

However if you wish this functionality to be a part of the API you can always share the concept on: https://community.esri.com/community/arcgis-ideas/

  • It works fine for my feature layer, which has relationships, as long as it's not using a related field as a searchField. – Barbarossa Oct 26 '18 at 18:32
  • @Barbarossa can you please share the service url if the service is public? – Gurminder Bharani Oct 26 '18 at 19:08
  • Unfortunately I cannot. The layer you reference in the first example works fine, but it is only a list of events, so it will not be a good geocoding source. If you search based on [status], i.e. 'New', it functions properly. – Barbarossa Oct 26 '18 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.