Display full version of the post: Field Expression in file name counting from the en

LGDB
06.01.2012, 00:14
Hello all. Happy 2012!
 
I'm looking for a 'field expression' to get just part of the file name. I found something here: 'CAD tip # 7003'
(http://www.cadforum.cz/cadforum_en/modified-drawing-name-as-an-automatic-field-tip7003)
 
I made some tests using the examples given. All work fine, but what I need is that the expression to count from the end to the beggining of the file name, as they have different number of characters. 
Eg:
The end of the files name are like this: "....... (01).dwg". I'd like to get just the '01'.
 
Two reasons I'd like to build it that way: 
1) This field expression would be part of the sheet set, so all drawing will have the same expression in title block.
2) The file names may change time to time, but the last bit: (01).dwg. 
 
Any ideas? 
 
Thank you very much!LGDB2012-01-06 00:38:23

LGDB
12.01.2012, 07:54
For now I'm using this expression:
$(substr,$(getvar,DWGNAME),3,$(-,$(strlen,$(getvar,DWGNAME)),9))
Sorry I understanding absolutely nothing about this issue, but I think it works like this, please correct me if I am wrong:
Suppose my file name is 'abcdef.ghi'1) It picks the 3o. character (letter 'c') of the file name,2) It starting counting from the end to the beginning starting on 3 (equals letter 'i') up to 9 and trims on letter 'd', leaving just the letter 'c', which it is what I'm looking for.
Is that right?
 
I'd like to find a way to trim after the letter 'c', using the example above, as the file names change the number of characters. If that thought is possible, I wouldn't have to change the last number for each drawing, which defeats the purpose of being something dynamic.
Does anyone know if this is possible?
Thank you!