Bug report #13013

Custom function accepted in 2.8 is invalid in Master

Added by Harrissou Santanna almost 9 years ago. Updated almost 9 years ago.

Status:Closed
Priority:High
Assignee:-
Category:-
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:21089

Description

I have created a custom function ($compta) within the new Function Editor in QGIS 2.8.

@qgsfunction(args=0, group='Custom')
def compta(value1, feature, parent):

    nb = 0
    for idx in range(len(feature.attributes())):
        attr = feature.attributes()[idx]
        if not attr ==  NULL : 
            nb = nb +1
    return nb

In master, when tring to use this function, I get an error

Parser Error:

Special column is not known

Eval Error:

No root node! Parsing failed?

BrokenCustomFunction.png - The behaviour in 2.8 and 2.9 side by side (43.6 KB) Harrissou Santanna, 2015-06-20 09:28 AM

History

#1 Updated by Salvatore Larosa almost 9 years ago

it is occurring because you are running the function from Recent list which has stored it with the $ char in 2.8 version.
in master version that char is not added to the function anymore (it was removed since e6403da)

the workaround here is re-run the function and choose it from Custom list.

#2 Updated by Harrissou Santanna almost 9 years ago

  • Status changed from Open to Closed

Thank you, Salvatore. I didn't see that change.

Also available in: Atom PDF