I have a map series layout that displays all the photo attachments associated with each feature in a line feature class, housed in a file geodatabase. This line feature class is the index layer of the map series based on Route IDs. A line feature can have as little as 1 photo attachment or as much as 8 or 9. I also have a point feature class that represents each photo taken along each linear feature. So for example, Route N974 will have 3 point features with a field titled [pt_number] that represents photo 1 along the route, photo 2 along the route, and photo 3 along that route.
Currently, I have all the potential photo attachments in the layout manually labeled as 'Photo 1', 'Photo 2', etc., but I then have to manually add/remove photo labels in the layout for each map series page due to the variable number of photos attached to each feature. So to fix this, I am trying to write an Arcade expression that will dynamically label the photos so, for example, if there isn't a 4th photo attachment, that label just doesn't show up in the export and I can iterate through all features in one go without needing to make changes between map series pages. Currently, if there isn't a 4th attachment to fill that slot in the layout, no photo or anything appears in the export, which is also what I want the photo labels to do.
I am using a table attribute dynamic text element to do this, with the source table being that photo point feature class. But I cannot figure out the proper Arcade syntax to essentially select the nth element of the variable... And I probably am not stating/asking this correctly/accurately which is why I am having trouble finding a solution. Right now, I have this:
Where it is labeling all three photo points (result on the left), but I want to be able to tell it to just select the first element and just get 'Photo 1' for the first label, and so on. I feel like I should be able to write something like this (similar to how R works):
'Photo ' + $feature.pt_number[1]
Don't know if I am barking up the wrong tree here/if this is possible. Any other suggestions on how to solve this problem? Using ArcGIS Pro, version 3.1.0