Almost have this quandry figured out, but inevitably a new problem has popped up. I finally have the "code" part down to do what I want, but now the font formatting isn't acting properly. When I use a simple expression with font tags I can create this image. enter image description here
However, when I use the advanced expression as follows, it returns the garbled image after. I'm using the tags the same way and can't find any reason they shouldn't be working. Without quotes I get a syntax error. EDIT - Trimmed code to focus on issue area. Font tags were improperly placed, see answer 1.
if float([Percentage_Complete]) >= 90:
lab1 = "<bol><clr green='255'>" + lab1 + "</bol></clr>\n"
if float([Percentage_Complete1]) >= 90:
lab2 = "<bol><clr green='255'>" + lab2 + "</bol></clr>\n"
if float([Percentage_Complete2]) >= 90:
lab3 = "<bol><clr green='255'>"+ lab3 + "</bol></clr>\n"
if float([Percentage_Complete3]) >= 90:
lab4 = "<bol><clr green='255'>"+ lab4+ "</bol></clr>\n"
enter image description here
3 Answers 3
This was determined to be the issue to this problem. It will be marked as the answer soon. When using format tags make sure they close from inside out. Thanks to @kenbuja for clarifying that.
"<bol><clr green='255'>"+lab4+"</clr></bol>"
NOT "<bol><clr green='255'>"+lab4+"</bol></clr>"
-
Would you be able to edit your answer to state clearly that it does answer your question, please? Also, so others do not have to go through the same pain perhaps you can simplify your question to just the parts that in hindsight were causing all the problem so that a cleaner Q&A results?2014年07月21日 21:06:39 +00:00Commented Jul 21, 2014 at 21:06
-
Sure I can do that, I tried to mark it as the answer, but said I had to wait two days. But I'll clean it up.twistr25– twistr252014年07月22日 12:00:07 +00:00Commented Jul 22, 2014 at 12:00
This works to simply bold text and include a new line:
"<bol>" + [PointID] + "</bol>" + "\n" + [Structype]
to get
6438
Manhole
-
This doesn't provide an answer to the question, how you set green color if the number is greater than 90?aldo_tapia– aldo_tapia2017年08月25日 19:45:51 +00:00Commented Aug 25, 2017 at 19:45
Try using the ampersand as you suggested and use vbcrlf instead of \n. I don't think \n works
"" + [PARCEL] & vbcrlf & "TEXT" & "" something like this
-
If it matters, the error I get with the & indicates a problem between 'str' and 'unicode'. I assume the unicode is my variable name lab1, lab2, etc. Oh, and I thought I mentioned it, but guess not, this is for Python not VBtwistr25– twistr252014年07月21日 18:42:33 +00:00Commented Jul 21, 2014 at 18:42
-
can you convert the unicode in the attributes ? Something like str(lab1) ?jbchurchill– jbchurchill2014年07月21日 18:49:14 +00:00Commented Jul 21, 2014 at 18:49
-
Yes I suppose I wasn't thinking about the code you had there. I was thinking it was code you put in an expression. It wouldn't be easy to redo it if it were a script. Still I can run the str() python function on my attributes and it works.jbchurchill– jbchurchill2014年07月21日 18:56:24 +00:00Commented Jul 21, 2014 at 18:56
-
Another good thought, but no go.twistr25– twistr252014年07月21日 18:56:56 +00:00Commented Jul 21, 2014 at 18:56
-
It is code I put directly into the advanced expression box in the label properties under the Python parser.twistr25– twistr252014年07月21日 18:58:26 +00:00Commented Jul 21, 2014 at 18:58
<bol><clr green='255'>"+ lab4+ "</clr></bol>\n"
for each of them.