0

I have two tables: One, where I digitize water pipes (A) and a second one with pipe-types(B, not mappable). The pipe-types layer contains several columns like type, material, diameter_inside, diameter_outside etc. When I digitize a pipe in my layer, I just want to select via dropdown menu one of the types which are included in the pipe-types layer. All the other fields should then be automatically filled with the corresponding information.

So far, I only get my drop-down menu via layer properties -> attribute forms -> widget type "value map" and selecting the type-layer here. How can I reach the autofill function for the other fields?

1 Answer 1

4

Here is one suggestion: continue using the value map where the data is derived from a pipe_types layer - this can be a non-spatial layer which just contains the look-up data. Edit the settings in the water_pipes layer for each field that has to be filled with data from the pipe_types layer with an expression like this in the default text box: enter image description here

map_get(attributes(get_feature('pipe_types','pipe_type',attribute('type'))),'pipe_material')

Where the syntax is like this:

map_get(attributes(get_feature(lookup-layer name,join fieldname in lookup-layer,attribute(join fieldname in this layer))),fieldnamefor the value you want)

Make sure you check the Apply default on update setting ON.

This is what the expression looks like in the expression editor:

enter image description here

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.