2

I'm struggling with an ArcGIS JavaScript API 4.4 popup.

There are dozens of attributes on dozens of layers, which is a lot of coding if I have to specifically mention and format every single one. I want to bring in every attribute that is published in a given feature layer, and thought this would work:

var infoPopup = new PopupTemplate({
    title: "Feature Attributes",
    content: "{*}"
});
var layerPole = new FeatureLayer({
    url: "http://****/arcgis/rest/services/Click/XY_Rewrite/MapServer/22",
    opacity: 0.9,
    popupTemplate: infoPopup
});

I was thrilled when it looked like it worked...

popup with limited attributes

... but on further examination, that's only three of the 34 attributes published in the map service. There's no apparent reason those three were chosen -- they aren't all the same type, they aren't the first three in the field list, etc.

  • OBJECTID ( type: esriFieldTypeOID , alias: OBJECTID )
  • CREATIONWORKREQUESTID ( type: esriFieldTypeString , alias: Creation Work Request ID , length: 10 )
  • LASTWORKREQUESTID ( type: esriFieldTypeString , alias: Last Work Request ID , length: 10 )
  • G_KEY ( type: esriFieldTypeInteger , alias: G_KEY )
  • SUBTYPECD ( type: esriFieldTypeInteger , alias: Subtype )
  • SYMBOLROTATION ( type: esriFieldTypeDouble , alias: Symbol Rotation )
  • MATERIAL ( type: esriFieldTypeString , alias: Material , length: 5 , Coded Values: [WD: Wood] , [ST: Steel] , [FG: Fiberglass] , ...3 more... )
  • CLASS ( type: esriFieldTypeString , alias: Class , length: 5 , Coded Values: [4: Class 4 Pole] , [0: Class 0 Pole] , [00: Class 00 Pole] , ...7 more... ) POLENUMBER ( type: esriFieldTypeString , alias: Pole Number , length: 20 )
  • (etc)

What's wrong with this JavaScript popup, what's wrong with my map service, or is there a better way to drop all published attributes into a popup template ?

1

We had a very similar issue a few months ago, where not all attributes were coming across. We found that we had to go to the REST Services page and replace the 'WHERE' text field with the whole SELECT statement (SELECT attributeA, attributeB, attributeC FROM <Table> WHERE STATUS = 'Up' ) Once we made this change, all attributes came in as expected. See below for a screenshot of what we had in place prior to adding the full script.

Screenshot of our REST page while we were having the issue

  • Yes, ours also has WHERE. Do you happen to have instructions on how to change it to SELECT instead (does this happen during publishing the map service, within Server Manager, is it version dependent, etc)? – Erica Sep 19 '17 at 18:49
  • Just put the full SQL SELECT statement inside the text box for WHERE. I honestly have no idea how we even figured this out, but it was a painful process trying to figure it out. Hopefully this will help you! – MaryBeth Sep 19 '17 at 18:52
  • It may be related, but that SQL is buried in some of the Esri JavaScript API stuff :( – Erica Sep 19 '17 at 18:53
  • 1
    It's almost like there is a disconnect somewhere in the REST services, from our experience. We wanted all of our attributes to show and they were all contained in the same table, so a simple 'SELECT * FROM <table> WHERE STATUS..." did what we needed. – MaryBeth Sep 19 '17 at 19:54

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.