View Full Version : Breaking long strings of text data in Annotations
JeremiahM
2005-05-03, 09:01 PM
I am creating Map Annotations that use data from a linked SQL DB. One of my fields is a Text field that regularly contains more than 100 characters. By default the annotation object shows this field as a single line of text. Here is an example (by field):
Field 1 & 2-------BFC25-24H .1995
Field 3-------------A,907-914+XD,9-12+A,932-939+XD,21-22+A,923-924+XD,925
Field 4-------------37
I need to break Field 3 into 20 character or so segments and I would like the break to occur before a +. I should look something like this:
A,907-914+XD,9-12
+A,932-939+XD,21-22
+A,923-924+XD,925
Can I do this using the expression evaluator or lisp? Any help would be appreciated.
Jeremiah
Glenn Pope
2005-05-03, 09:25 PM
You could easily make an expression that would take so many characters.
ex. (substr *FIELD* 0 20) result = A,907-914+XD,9-12+A,
Then the next line would use an expression that starts where the previous one left off.
ex. (substr *FIELD* 21 20) result = 932-939+XD,21-22+A,9
The hard part would be making it break before the plus "+". I can't think of anyway of making it easy enough for the expression to handle it. There are limitations on the number of items you can make an expression do at one time. I think its 4. Anything beyond that that the expression won't be executed. Really you would need something that would loop until it hit a "+". I don't think that you can do that in expressions.
JeremiahM
2005-05-03, 11:26 PM
Glenn, where did you learn about Expressions? I have been looking for a good resource. The help file gives an excellent overview of the content, but it lacks sorely in the process of putting together something usable. Any direction would be appreciated.
Thanks for the tip as well, it has to look for the plus, if it is broken any other way the engineers and contractors will not be able to use it.
Guess what I am looking for is a good set of usable examples to learn context from.
Thanks, Jeremiah
MHultgren
2005-05-04, 12:06 AM
Jeremiah,
Try posting your question regarding string search in the Lisp forum. I'm pretty sure Peter Jamtgaard either has something for that or can whip you one up in short order.
Glenn Pope
2005-05-04, 01:50 PM
I basically just learned by trial & error. You can use basic lisp functions in the expressions. So if you know a little lisp you can do some pretty cool things.
Writing a lisp routine would be pretty easy. The problem would be getting it to work with the annotation. I can't see a way of doing it that would be easy. I'll try to look into it some more.
MHultgren
2005-05-04, 02:27 PM
I think you could create a search that looks for the + sign and sets a counter, then place the SubStr from 0 to Cntr-1, insert a linefeed, loop through the string again starting at counter to next + sign and repeat as needed.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.