Hi Richard ??? thanks for your response. I think your solution would work if the text came from a single field. Unfortunately out text string is not retrieved from a single field (like [My_Field]), but built from many fields. We do it like this so we can control the colour of each character/symbol independently with tags around the field, e.g. FindLabel = "<CLR cyan='100'>" & [PoliceStation] & "</CLR>" & "<CLR magenta='100'>" & [CaravanPark] & "</CLR>"
Function FindLabel ( [PoliceStation], [CaravanPark], [Field3], [Field4], [Field5], [Field6], [Field7, [Field8]) ' etc. for all fields in your list myStr = "" myBreak = 6 i = 0 if [PoliceStation] > " " Then i = 1 myStr = "<CLR cyan='100'>" & [PoliceStation] & "</CLR>" End If if [CaravanPark] > " " Then ' This begins the basic block to copy if i = mybreak Then myStr = myStr & vbnewline i = 0 End If i = i + 1 myStr = myStr & <CLR magenta='100'>" & [CaravanPark] & "</CLR> End If ' This ends the basic block to copy if [Field3] > " " Then if i = mybreak Then myStr = myStr & vbnewline i = 0 End If i = i + 1 myStr = myStr & <CLR magenta='100'>" & [Field3] & "</CLR> End If if [Field4] > " " Then if i = mybreak Then myStr = myStr & vbnewline i = 0 End If i = i + 1 myStr = myStr & <CLR magenta='100'>" & [Field4] & "</CLR> End If if [Field5] > " " Then if i = mybreak Then myStr = myStr & vbnewline i = 0 End If i = i + 1 myStr = myStr & <CLR magenta='100'>" & [Field5] & "</CLR> End If if [Field6] > " " Then if i = mybreak Then myStr = myStr & vbnewline i = 0 End If i = i + 1 myStr = myStr & <CLR magenta='100'>" & [Field6] & "</CLR> End If if [Field7] > " " Then if i = mybreak Then myStr = myStr & vbnewline i = 0 End If i = i + 1 myStr = myStr & <CLR magenta='100'>" & [Field7] & "</CLR> End If if [Field8] > " " Then if i = mybreak Then myStr = myStr & vbnewline i = 0 End If i = i + 1 myStr = myStr & <CLR magenta='100'>" & [Field8] & "</CLR> End If 'etc. FindLabel = myStr End Function
We use a FindLabel expression to retrieve characters from a number of attribute fields (up to 32). The characters correspond to a font which display as symbols on the map, e.g. �??C�?� displays a Caravan Park symbol. The characters are concatenated into a single character string. There are no characters separating the symbols (e.g. a space). Where a feature has a lot of facilities (e.g. a major town), the resulting line of symbols can be rather long and look clumsy on the map.We would like to use an expression to force a line break after a given number of characters (e.g. 6), so that the symbols are stacked in a neat pile near the feature they describe. We have tried using the �??Stack Label�?� function in Maplex but have so far got inconsistent results.We�??d be grateful for any suggestions of a way to consistently force a line break after a specified number of characters.[ATTACH=CONFIG]13404[/ATTACH]
Function FindLabel ( [My_Field] ) myStr = "" myBreak = 6 For i = 1 to Int(Len( [My_Field] )/myBreak) if i = 1 Then myStr = Left( [My_Field], myBreak) End If myStr = mystr & vbNewLine & Mid([My_Field], i * myBreak + 1, myBreak) Next FindLabel = myStr End Function
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.