Diesel adding an undesired blankspace to string

Diesel adding an undesired blankspace to string

xiandavis
Enthusiast Enthusiast
227 Views
2 Replies
Message 1 of 3

Diesel adding an undesired blankspace to string

xiandavis
Enthusiast
Enthusiast

Our company uses the following sheet naming convention:

Dxx detailSheetName

 

where Dxx is a detail number from D1 to D99.

 

The intent of the below Diesel expression is to pull the Detail number from the Layout tab name for either a single digit or double digit following the D and update the field inside the attribute.

 

Running the below code on Layout tab "P2 WALKWAY PAD LAYOUT" displays the desired "P2", but with a leading space " P2".

Running the below code on Layout tab "P10 ERRC CONDUIT PENETRATION" displays the desired "P10", but with a leading space " P10".

$(if, $(eq, $(substr, $(getvar, ctab),4,1), " "), $(substr, $(getvar, ctab),2,2), $(substr, $(getvar, ctab),2,3))

Apparently there is an invisible/escape character in the string, as I would expect the below numbers would have produced the desired results:

$(if, $(eq, $(substr, $(getvar, ctab),3,1), " "), $(substr, $(getvar, ctab),1,2), $(substr, $(getvar, ctab),1,3))

 

Any suggestions on how to eliminate the leading blank space character, or at least know where it is coming from? I came up with the syntax after looking at several Diesel examples in the forums.

 

Thank you.

0 Likes
Accepted solutions (1)
228 Views
2 Replies
Replies (2)
Message 2 of 3

cadffm
Consultant
Consultant
Accepted solution

Hi,

remove all the unneeded blanks in your Dieselcode!

Means all, except the one between " "

Try it again..

Sebastian

Message 3 of 3

xiandavis
Enthusiast
Enthusiast

Thanks!

0 Likes