You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ArcGIS Feature Table关联表填充字段及streetName列不显示问题咨询

Let's walk through why your streetName column isn't appearing in the Feature Table, even with related records enabled, and how to populate it using your associated table.

First, Understand the Core Issue

The showRelatedRecords: true setting only enables a panel to display related records separately—it doesn’t automatically pull fields from the related table into the main Feature Table columns. If streetName lives in your associated table (not the main feature layer linked to the Feature Table), your current configuration won’t render it because:

  1. The main Feature Layer doesn’t return related table fields in its outFields.
  2. The Feature Table can’t natively merge related fields into its primary grid without custom code.

Step-by-Step Fixes

1. Verify Where streetName Resides

First confirm:

  • Is streetName a field in your main feature layer, or only in the related table?
    • If it’s only in the related table: You’ll need to add it as a temporary field to your main layer (client-side) and populate it via association queries.
    • If it’s in the main layer: Double-check it’s not accidentally hidden or excluded in your config.

2. Add streetName to the Main Layer (If It’s a Related Table Field)

If streetName lives in the related table, add it to your feature layer’s field definition before initializing the Feature Table:

// Add the streetName field to your feature layer's schema (client-side)
featureTableLayer.fields.push({
  name: "streetName",
  type: "string",
  alias: "Име на улица (општина)"
});

3. Populate streetName Using Related Records

Use the show-related-records event (or the Feature Table’s load event) to query related records and update the streetName field for each main table record:

myFeatureTable.on("show-related-records", async (evt) => {
  // Get selected records from the main Feature Table
  const selectedRecords = myFeatureTable.getSelectedRecords();
  
  for (const record of selectedRecords) {
    // Query related records (replace "<YOUR_RELATIONSHIP_NAME>" with your actual relationship name)
    const relatedResults = await record.queryRelatedRecords("<YOUR_RELATIONSHIP_NAME>");
    
    // Extract streetName from the first related record (adjust logic if multiple related records exist)
    const relatedRecords = relatedResults["<YOUR_RELATIONSHIP_NAME>"];
    if (relatedRecords && relatedRecords.length > 0) {
      record.attributes.streetName = relatedRecords[0].attributes.streetName;
    }
  }
  
  // Refresh the Feature Table to show the updated streetName values
  myFeatureTable.refresh();
});

4. Double-Check Your Feature Table Config

Ensure your existing config doesn’t block streetName:

  • Confirm streetName is included in outFields (you already have this covered).
  • Make sure streetName isn’t listed in hiddenFields (your current hiddenFields only includes objectid and globalid, which is fine).
  • Verify the fieldInfos entry for streetName has editable: true (you have this set correctly).

Additional Checks

  • Test your relationship query separately to ensure it returns the expected streetName values.
  • If streetName is a calculated field in the related table, confirm the service exposes it in its outFields.

内容的提问来源于stack exchange,提问作者Novica Josifovski

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 20:52:51