AnsweredAssumed Answered

Creating multiple commands within Label Expression - Python

Question asked by msalinas1 on Mar 19, 2015
Latest reply on Mar 20, 2015 by msalinas1

Hello,

 

I am trying to create a Python expression for my labels to create a set of multiple lines displaying various field of my attribute table (accomplished), and to make sure that one of the fields that I include has a command to only capitalize the first letter of the word.

 

This is what I have:

 

def FindLabel ( [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_N] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_M] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.VITICULTUR] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_PLANT] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.ACRES] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.VineRow] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.TRELLIS] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.DIRECT] , [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.RTSTLK]  ):
   return " " + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_N] + ' ' +  '-' + ' ' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_M] + '\n' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.VITICULTUR] + ' ' + '-' + ' ' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.PBLK_PLANT] +  '\n' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.ACRES] + ' ' + 'acres' + ' ' + '-' + ' ' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.VineRow] +  '\n' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.TRELLIS] + ' ' + '-' + ' ' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.DIRECT] + ' ' + '-' + ' ' + [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.RTSTLK]

 

   S = [CentralValleyRanches_AllInfo_woCOORD_REDO.txt.VITICULTUR]
   S = S.title()
   return S

 

 

ex.JPG

The expression successfully created this. However, I want to make the "MERLOT" in the label into "Merlot"

 

My questions are:

1. How do you add multiple commands within an expression?

2. Is there something you must include each time there is a new command?

 

Many thanks in advance!

Outcomes