1

I am attempting to display related fields in a popup window. I've created a GraphicsLayer, consisting of features from the results of a QueryTask. Upon adding the features to the GraphicsLayer, I am assigning a popupTemplate to each feature:

var popupTemplate = {
  title: "<b>{LONGNAME}</b>",
  content: [{
    type: "fields",
    fieldInfos: [{
      fieldName: "SPACEID",
      label: "Space Identifier",
      visible: true
    },{
      fieldName: "relationships/1/VERTICALORDER",
      label: "Vertical Order",
      visible: true
    }]
  }]
};

However, this technique does not seem to be able to reference the related table. The [SPACEID] field value is visible, but the related field value is not. Am I doing something wrong, or is there a different way to accomplish this?

EDIT: Perhaps this functionality is not possible yet? I've tested this with a simple FeatureLayer, and the relationship is not honored.

var layer = new FeatureLayer({
    url: baseURL + "/2",
    popupTemplate: {  // autocasts as new PopupTemplate()
        title: "<b>{LONGNAME}</b>",
        content: [{
            type: "fields",
            fieldInfos: [{
                fieldName: "SPACEID",
                label: "Space Identifier",
                visible: true
            },{
                fieldName: "relationships/3/FIRSTNAME",
                label: "Employee Name",
                visible: true
            }]
        }]
    }
});

I have verified the relationship is functioning, using the REST queryRelatedRecords window. However the FeatureLayer does not see the table. Is there something further that needs to be done? I should note that the service is a MapService, in case that matters.

This issue is discussed here and elsewhere.

1 Answer 1

0

fieldName: "relationships/1/VERTICALORDER" means that have created a second RelationShip in your GraphicLayer.

If you didn't, (otherwise you would have post the code) then you have two options :

1
  • I have a relationship for the MapService layer from which the features used to create the GraphicLayer came from. The GraphicLayer doesn't, as far as I can tell, have any relationships. Can you elaborate on how one would create a new relationship?
    – Barbarossa
    May 23, 2018 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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