Display full version of the post: Diesel Field Expression - If Statement

martingtc
17.06.2016, 10:30
Hi, I'm new to the world of fields and diesel (using 2008 LT so I dont have a right click menu)I've managed to set up some auto fills based on partial filenames etc. One I'm stuck on is a drawing refBasically we call our drawing files a 5 digit reference. I have done this one.Our sheet numbers are 3 digits, again, this is sorted.When we revise the drawing, it will become XXXXX-Rev01. I'm trying to add the -Rev01 part to the sheet number which I can do, but if the drawing is not yet revised (so still XXXXX) it shows up as ----I'd like to remove these and show blank, unless there is a -Rev01, then show that if that's the case.Can anyone help??Thanks in advance

martingtc
20.06.2016, 09:51
Can anyone help??

Vladimir Michl
20.06.2016, 10:01

This DIESEL expression will take the drawing name from the sixth character: [CODE]$(substr,$(getvar,dwgname),6)[/CODE] You can combine it with $(if - based on string length or the "Rev" substring. 

martingtc
20.06.2016, 12:25
Can you explain the IF side of it please?Example;Drawing no. 101 - my paperspace (at the moment) shows 101 - perfectfilename 12345-Rev01I want my paperspace to show 101, but also the -Rev01 from the filename. I can get this to work, but only if there is a Rev.If the file is 12345, the paperspace titleblock shows 101----:( I'd like to hide the dashes if there are no characters to show and I'm so new, I don't know how to control an IF statement just yetThanks,[edit, the 101 drawing no. is pulled from a tab, the Rev01 needs to be pulled from the filename - so in theory 2 different diesel expressions next to each other?]

martingtc2016-06-20 12:37:46

martingtc
21.06.2016, 09:25
Anyone please? It's for work and I'm really struggling :(

martingtc
24.06.2016, 15:34
Anyone?