Bug report #18130

Using uuid generator function in field calculator return the same value for each feature

Added by Dominique Lyszczarz almost 3 years ago. Updated almost 3 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Field calculator
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:26023

Description

It seems to me that the correct behaviour here is to compute a distinct uuid for each feature.

A work around is to define a custom function like this

@from qgis.core import *
from qgis.gui import *
import uuid

@qgsfunction(args='auto', group='Custom')
def getUUID(feature, parent):

return '{' + str(uuid.uuid4()) + '}'@

Associated revisions

Revision 605ea376
Added by Nyall Dawson almost 3 years ago

Fix uuid() function returns the same uuid

Fixes #18130

History

#1 Updated by Nyall Dawson almost 3 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

#2 Updated by Giovanni Manghi almost 3 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF