3

I'm having trouble with a large label expression and I keep crashing with an application error. I'm trying to display sample results as stacked:

Label ID

Sample depth 1

Sample Depth 2

Sample Depth 3

Now, I also want each of those depths to have three criterias. (Regular, Bold, or RED) Depending on what the value exceeds. So for example:

SB-1

5

10.5

100(red)

So I've joined an excel table with the sample results enter image description here

As you see I have a depth field followed by the next three cells being the results based on their criteria. Could not figure out a way to color them based on their value. (<9.5 , >9.5, >45)

This is the VBScript I am currently using.

[MAP_ID] &vbnewline & [F5] & "<BOL>" & [F6] & "</BOL>" & "<CLR red = '255'>" &  [F7] & "</CLR>" &vbnewline & [F9] & "<BOL>" & [F10] & "</BOL>" & "<CLR red = '255'>" &  [F11_1] & "</CLR>" &vbnewline & [F13] & "<BOL>" & [F14] & "</BOL>" & "<CLR red = '255'>" &  [F15] & "</CLR>"

I'm sure there is an easier way to do this...

I did not have a problem with the same expression with only one depth as you can see hereenter image description here

I've tried changing blank values from null to " ", thinking this could be the issue, but no different result, still crashed..

Update, I have exported to shapefile so the attributes are no longer pulling from excel. Also, I have found that if i replace the blank spaces with a value (i.e. "-" or "NA") I do not have this same issue. Except the problem with this is that now I get labels like:

SB-1

5 - -

-10.5 -

--100(Red)

It seems that the spaces tend to be the problem. Maybe an If Then statement is necessary?

  • 1
    Any error message, or does it just crash? Also, what version of desktop are you using? – artwork21 Jan 26 '17 at 19:24
  • Don't see your closing formatting color tag, & "</CLR>" – T. Wayne Whitley Jan 26 '17 at 19:32
  • No error message. Expression does verify-but crashes once its actually displayed on the map. Sometimes I can get it to display once, then any additional refresh (pan) causes a crash. Version 10.3.1 – Adam Jan 26 '17 at 19:33
  • 1
    The issue may have nothing to do with your actual expression. Just an idea, I find anything to do with Excel is BAD! Export you Excel table to say a personal or file geodatabase and use that instead. Excel does not enforce good data structure unlike a database so it's possible you have some crazy cell value... – Hornbydd Jan 26 '17 at 23:00
  • 2
    I would label only F5, if that works add F6, etc until F15, to isolate the field or formatting causing the error. – klewis Jan 27 '17 at 1:23
1

Try doing it with an advanced python label function. With that you have the ability to test your values and format accoringly. Test for values of None or null... not to replace directly but to hard code those values to be what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.