I have to detect point elements with QField and for each point take photos whose name is to be inserted in a specific field of the attribute table. How can I get that for each point the "photo" field contains all the names of all the photos I took for that point?
1 Answer
Follow the guidance here to create your photos relation and capture photos against each point feature.
Then create a calculated field in the point feature table, using an expression something like:
array_to_string(
relation_aggregate(
relation:='mypoint_to_photo_relation',
aggregate:='array_agg',
expression:=replace("path", 'DCIM/',''),
concatenator:=', '
)
)
In the above expression, i have assumed "path" is the attribute name in the 'photo' table that stores the photo path and fielname. I have used replace() on "path" to strip out the 'DCIM/' part of the relative path leaving only the filename. I have used ', ' as a concatenator. Note, relation_aggregate() returns an array. To make this readable in your attribute I have wrapped this array_to_string().
As an example, I have applied this to my own tree survey set-up, in which I capture photos against each tree, an example output is
'20240725_122102_T17.jpg', '20240725_122111_T17.jpg'