I am looking for help on creating an expression to count the number of related features using (example) 1 of # number of related to feature. ex 1 of 3 (next feature shows) 2of 3 and then 3 of 3.
Any help would be greatly appreciated.
Thank you!
Knowing what the data looks like would help, but using FeatureSetByRelationshipName is the best way to quickly grab related records, if there's a legitimate relationship between the tables.
Is this for a popup? Field calculation? Dashboard?
var rel = FeatureSetByRelationshipName($feature, 'relationshipname', ['field1', 'field2', 'field3'], false) // count of related features var the_count = Count(rel) // build a popup out of related feature info var popup_arr = [] var feat_idx = 1 for (var r in rel) { Push(popup_arr, `Feature ${feat_idx} of ${the_count}: Field One: ${r['field1']} Field Two: ${r['field2']} Field Three: ${r['field3']}` ) feat_idx += 1 } return Concatenate(popup_arr, '\n\n')
Depending on where you're trying to use this expression, you may need HTML line breaks instead of \n, but try this out and see how it works.
@jcarlson My apologies, it is for a popup.
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.