Transmittal Template Designer/Expression Editor

Patricia HeubachPatricia Heubach Administrator Posts: 44 admin

We have four separate fields on our drawing title blocks, which are then extracted into four separate fields in our database.
For our transmittal, I'm trying to concatenate them all together with a space-dash-space to separate each line. However, if only one line of the title was used, I don't want to see a bunch of extra "space-dash-spaces". I was able to acheive this in Excel, but I'm having a hard time getting it to work in the Expression Editor in the transmittal designer.
So, for example, if the following is my drawing title:
Title 1: Ammonia II Plant
Title 2: Electrical
Title 3: J-402 Motor Schematic
Title 4: (Blank)
I would like to see “Ammonia II Plant – Electrical – J-402 Motor Schematic” (Note, that Title 4 is blank and therefore, excluded from the result)
I don’t want “Ammonia II Plant – Electrical – J-402 Motor Schematic - ” or “Ammonia II PlantElectricalJ-402 Motor Schematic”
Similarly, if lines 2 and 3 of the title are blank, I still only want to see "Line 1 - Line 4"

This is what I had used in our Excel version of the transmittal:
=SUBSTITUTE(IF(W37="",""," - "&W37)&IF(X37="",""," - "&X37)&IF(Y37="",""," - "&Y37)&IF(Z37="",""," - "&Z37)," - ","",1)

and This is what I have written in the Expression Editor so far:
REPLACE(IF([Drawing Title(T_TITLE1)]='', '', ' - '&[Drawing Title(T_TITLE1)])&IF([Title 2(T_TITLE2)]='', '', ' - '&[Title 2(T_TITLE2)])&IF([Title 3(T_TITLE3)]='', '', ' - '&[Title 3(T_TITLE3)]&IF([Title 4(T_TITLE4)]='', '', ' - '&[Title 4(T_TITLE4)])
When I hit OK, I get an error saying there's an invalid symbol at line 1, character 250, but it doesn't highlight anything, so I think it's actually a missing character. I don't know if this will do what I'm trying to do, anyway.

Do any of you have any ideas? They would be greatly appreciated!

Comments

  • rnettlesrnettles Moderator Posts: 11 mod

    You might try a variation of the following. I don't have the exact fields setup to test but the editor didn't give me a syntax error:

      Concat(
      Iif(IsNull([Title Line 1(C_TITLE1)]), '', Trim( [Title Line 1(C_TITLE1)] )), 
      Iif(IsNull([Title Line 2(C_TITLE2)]), '', Concat('-', Trim( [Title Line 2(C_TITLE2)] ))),
      Iif(IsNull([Title Line 3(C_TITLE3)]), '', Concat('-', Trim( [Title Line 3(C_TITLE3)] )))
    )
    
Sign In or Register to comment.