In QGIS 3.14 / QfieldSync there is now the functionality to configure photo naming. Yay!

I use a 1:n set-up for photos, i.e. I capture photos in the child table ('photo') of a one-to-many relationship. I would like to name my photos based on attributes ('type' and 'num') in the parent layer ('tree').

So far, my attempt at the expression is as follows:


This isn't working.

Any ideas?


okay, with much playing around, this is now working:

when "fkid" is null then 
    format_date(Now(), 'yyyyMMdd_hhmmss')||
    format_date(Now(), 'yyyyMMdd_hhmmss')||


  • "fkid" is the foreign key in the photos layer.
  • 'tree_pt' is the parent layer
  • 'uuid' is the primary key in 'tree_pt'
  • note the use of single and double quotes.

In my set-up, anyone of three parent layers may store image paths in 'photos'. So I wrap this up in coalesce() to check each layer for a match. Much like Highlander, there can be only one: I am using uuid.

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.