1

I have a point layer with 3 columns (all strings) with values looking like this:

name; C_No; F_No

123_SF_24; 123; 24

The values of the last two columns are supposed to be derived from different positions of the "name" value.

Using substr("name" ,0,5) and substr("name" ,8,2) works fine for two kinds of objects:

(1) already existing objects (with the field calculator in the attribute table)

(2) newly created objects (with the 'apply default value on update' in the attribute form)

However, the aim is to use this as the main point layer with a predefined style and to add many new points to it daily from a textfile. Consequently, i will neither add them manually point by point nor do I want to manually update every column of the whole thing each day.

So when I try to copy and paste objects from another point layer (including the "name"; also string) into this main one, the preset default value is not applied automatically even though the "name" is put in correctly. Saving doesn´t help either, the field just remains empty.

I was wondering if an automated update of fields is also possible when copying/pasting objects or if I am doing anything else wrong. I couldn´t find a relating issue so far and would be very happy if someone had a solution. I tried to put in every information, but in case anything is missing let me know and I will add it.

1 Answer 1

1

I have just tested this by putting the expressions substr("name",0,5) and substr("name",8,2) in the default options for the target fields of the main point layer, and for me it works.

Pasting from a layer that only has a name attribute, the default expressions are applied. My conclusion: what you want is possible.

There must be a mistake in your implementation. We just don't see it yet.

2
  • Hey Peter, thank you very much for trying. It´s good to know it should actually work!
    – Julia
    Sep 12, 2022 at 7:06
  • Right now it kind of works for me too, but only if I click in any field of every single pasted object. Then it updates correctly but this cannot be the way :( Interestingly, if I check the box "unique value" it does everything automatically (and immediately), but not with the correct values of course.. it uses whatever the first added value was for everything (even if they should differ according to the "name" field) and just puts a consecutive number at the end.
    – Julia
    Sep 12, 2022 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.