AnsweredAssumed Answered

Split a label over several lines, using commas, in python

Question asked by ben_vk on May 24, 2016
Latest reply on May 25, 2016 by ben_vk

Hi All,


I am trying my hand at using python to modify my labeling to suit.


I have a column which contains peoples names, this column can contain between one and four names, all separated by a comma. See sample data here:


Currently when I label based on this column it looks pretty boring, what I would like is to split the names onto a new line, based on the comma. So essentially I want to find the comma, and insert a new line with the next name on it.


This is what it currently looks like, and the code:

def FindLabel ([BENVA.%Burial_Data.NAM], [SDE_SPATIAL.GISADMIN.waugh_road_graves.GIS_Authority_Link]   ):
  na = [BENVA.%Burial_Data.NAM]
  if na is None:
    na = [SDE_SPATIAL.GISADMIN.waugh_road_graves.GIS_Authority_Link]
  return na



Does anyone have any sample code they could provide that would achieve this? Alternatively give me some guidance as to how one would go about this???


Thanks very much everyone.