6

I want to add a date field to my output layers attribute table, using processing modeler. I want the Date field to be a parameter in my model, because I want to manually input the Date everytime I run my model. Is there a way to do this, so the Date appears as a parameter before running the model (as shown in the picture) and the date entered then appears in the attribute table under a field titled Date. I want to give each layer I create a Date in the attribute table without having to edit the model each time.

I am new to QGIS.

Processing model parameter

1 Answer 1

5

In your QGIS modeler, add the Field Calculator algorithm as shown in the image below. I notice in your image that you have "Date" as a parameter name and you also want to use "Date" as a field name. Change the parameter name to another such as "Enter date", don't make it the same name.

In the Field Calculator settings, add "Date" in the Result field name option and you can type or select "Enter Date" from the dropdown menu in the Formula option:

Modeler

If you use Date as the Field type (as in the image), the format you enter must be 'YYYY-MM-DD'(note the single quotes!). If you want to use another format then use String as the Field type (remember to increase the Field length), you can then enter anything you like in whatever format you like.

Running model

Result

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.