1

I would like to have the autofill when filling my data attribute table field. The autofill like you have in some HTML form, etc. Basically If, for instance, I type the letter I, the autofill should show me some recently used words starting with this letter.

enter image description here

Like you see above, I have a record called INFERRED DUCT, which I have to copy every time.

How about if I could just type the letter I and the tool would autofill it for me?

I tried also to define the formula in the Attributes Form -> Defaults section, where I put the following formula:

    CASE WHEN "PLANT_ITEM" = 'I' THEN 'INFERRED DUCT'

but it didn't work despite no error message shown in the output preview.

Is there any way to make the auto population in the Data attribute table, as known from i.e HTML forms?

7
  • 1
    You can't fill attributes of newly created features based on values you're entering while creating said feature.
    – Erik
    Jul 29, 2021 at 9:00
  • Why? Could you sed me the link which tells about it?
    – Geographos
    Jul 29, 2021 at 9:07
  • 2
    Because expression need existing parameters to work with, but during creation the attributes aren't existing in the attribute table, yet. Hence you can't access them and base another attribute on them.
    – Erik
    Jul 29, 2021 at 9:20
  • OK, thanks for the explanation. I already found another way to solve it.
    – Geographos
    Jul 29, 2021 at 9:25
  • 1
    Then the whole feature including attributes still isn't comitted to the attribute table, hence you can't use its attributes to create other attributes.
    – Erik
    Jul 29, 2021 at 10:25

1 Answer 1

5

Go to Layer Properties -> Attribute Form and select the field you want autocomplete activated. Set the widget type to unique values (check the box "Editable"). This should do what you asked for!

enter image description here

To save those edits to the Attribute Form (and anything else like styling, rednering options etc) you can export them - in the bottom of the "Layer Properties" window you find the button "Style". There you can save the layer style file as .qml - you can load an exisiting layer style file the same way!

5
  • 1
    Your answer taught me a very useful tool, thanks! However, it appears that setting the widget to Unique Values only applies to the current project. If the same layer (or table) is added to a different project, the Attributes Form reverts to the default Autogenerate setting. Do I have that correct?
    – Stu Smith
    Jul 29, 2021 at 15:58
  • this is correct. the Attribute Form is saved in the layer styling (same as the label settings, coloring, zoom dependend rendering etc etc). you can export all layer settings to a file and import it. I added this to my answer!
    – sn1ks
    Aug 2, 2021 at 5:50
  • 1
    While the drag and drop designer is a nice tool to control the order and layout of fields, it's not strictly required here. It can be left to autogenerate and configured to use unique values as well. Aug 2, 2021 at 6:07
  • @MatthiasKuhn true that, i edited the answer to be more on point - got caught in my normal routine of managing layers!
    – sn1ks
    Aug 2, 2021 at 6:16
  • More than happy to read that the drag and drop designer made it to the everyday tool suite. Aug 2, 2021 at 6:22

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.