Hello all,
I'm trying to create a text substitution that will insert a range of characters from the file name.
For example, I have a dgn named 123_plan.dgn.
My border contains the text $DGNNUMBER$
I have defined a text substitution in my pen table as follows:
Actual Replacement
$DGNNUMBER$ _FILES_
The result, of course, is that if I print 123_plan.dgn with this pen table, I get "123_plan.dgn" in my border in place of "$DGNNUMBER$".
What I'd like to do, is modify the replacement to only part of the filename. What would I need to do in order for the replacement to show "123" instead of "123_plan.dgn"?
Thank you.
You may be able to do this using a named expression. I will see if I can figure it out. Someone else with more knowledge of named expressions may have the answer more quickly. I will let you know.
Thanks for looking in to this Dawn. After Googling on it for a while, I was starting to reach the same conclusion. Although I know very little about named expressions, I've gathered that it might be something along the lines of:
System.String.SubString(ActiveFile.FileName, 0,3)
I don't know if that's the right syntax or even the right functions, and I'm not at my work PC to test, but it might prompt the reply I'm hoping to get here.
I do have one question. Can you provide more information on the filename structure? Will the part of the filename you want to capture always be at the beginning, before an underscore?
The reality is a little more complex than my example above. All the file names start with a 3 letter identifier followed by an underscore, then the number I'm after, followed by another underscore and the drawing title. So for example:
abc_123456_project plan.dgn
Would this number happened to be stored in any other place such as a variable or tag?