Has anyone succeeded in using a file naming expression including a field value from a parent layer -attribute(@current_parent_feature,‘’)- in a child layer? The child layer has an attachment widget for taking photos and I try to include the expression in layer properties – I can’t get it work neither in ver. 3.7.9 nor in beta version of 4.0.
@FelixHinckel Thanks for your time and suggestion. However, I tried that approach first without any success. (Sorry for not mentioning that!) I have also used “attribute(get_feature(‘Parent_layer’,…” in other fields with success, but not in the filename expression. After seraching the internet, I found promising information regarding using @current_parent_layer in 5327. But I can’t get it working, so now I’m looking for proof that it actually works and that I (hopefully?) just have (spelling) error in my expression.
@FelixHinckel Not sure what you mean. In my case I use a field called ‘plotid’ which gets it value from the parent-laye. ‘Plotid’ gets the correct value on-the-fly, see the screendump in the link to the issue-page (#6862). Do you mean I should add another field, called ‘Name’, in the layer and calculate the Name-value to be equal the Plotid-value? And in stead of ‘Plotid’, use ‘Name’ in the expression shown in the screendump above? (Sorry for being slow on a Friday afternoon in my timezone.) By the way, I also tried to use to_string on the attribute(@parent_...-expression - without any success.
The string ‘value’ doesn’t get included in the file name. (The ‘JPEG’ outcome is actually a default because the one I set led to an error : we can see there isn’t event the ‘picture_’)
@FelixHinckel Thank you so much! I really appreciate your help and effort. Nevertheless, I can’t get it work in my case. I have made a test-project and uploaded it in a Comment in issue 6862: Just in case you have the time/are curious. Perhaps the challenge is that attribute plotid in ‘plott start’ is “taken from” another layer ‘jvpunkter’ – even though plotid is shown in layer ‘plott start’?
For functions that seek attributes in other layer features, these feature have to be validated beforehand. In your case : as long as you don’t validate your plott start point, the startbilder won’t be able to access its data.
Example from your project : I created a plott start, satisfied all the constraints, and saved it. When I want to modify it and add a picture, the functions you set work well :
With this configuration, as soon as your plott start satisfies the constraints, the feature is automatically validated and saved. Which allows you add pictures with correct naming. In other word, with this setting, as soon as the form turns green you can add pictures.
@FelixHinckel Juhu, it works! Thank you! Fast editing mode was activated, but I had not fully understood the concept that all constraints had to be satisfied before I captured the photo. I just entered data from top to bottom in the form. Thank you for enlightening me.