1

I am trying to design a little large model, and writing it i need to add fields and calculate them in output layer A from route finding point to point function before I append my result to the main layer B. I tried both field calculator after creating the field separately with add field(Even this function didn't work) and Advance python field calculator to create and calculate the field(Two in one) as image below:

Processing tool screenshot

Still getting an error with advance python and no error with normal add field function, but not working.

1- Is this a bug, or am doing something wrong 2- Is there any limitation for tools to create a field inside temporary layers in graphic designer (can add fields from layer properties )

The model look like below image, Top values are for field value input with corresponding with 4 new fields

Diagram in modeler

2
  • 1
    What type of input is "Project name"?
    – Erik
    Commented Aug 25, 2022 at 14:08
  • @Erik string type Commented Aug 25, 2022 at 14:12

1 Answer 1

2

Assuming your model input Project Name is a string, you either need to add single quotation marks ' around your name, in order for the field calculator to interpret it as a string. Otherwise the name will be treated as a column name.

The other solution is to change your field calculator back from model input to value, then choose among the bold options on the right the entry project name. This will add the local variable @project name as expression.

3
  • Same Error >>>>> Running Add field, Calc Project Name [5/10] Input Parameters: { FIELD_LENGTH: 200, FIELD_NAME: 'project_na', FIELD_PRECISION: 0, FIELD_TYPE: 2, FORMULA: 'Route Survey to NGL fractionation', GLOBAL: '', INPUT: 'memory://LineString?crs=EPSG:4326&field=start:string(0,0)&field=end:string(0,0)&field=cost:double(0,0)&uid={dd808834-d986-4162-bf77-f5bcb220faf0}', OUTPUT: 'TEMPORARY_OUTPUT' } Error encountered while running Add field, Calc Project Name Execution failed after 9.30 seconds Commented Aug 25, 2022 at 14:33
  • This works perfectly with the normal field calculator.
    – Erik
    Commented Aug 25, 2022 at 14:47
  • Yes It works, with both add field, and normal calculate field which am going to use to make new and calculate the field, thanks alot Commented Aug 27, 2022 at 9:10

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.